I have an Android app in which I wanted to use the DB2SimpleDataSource class contained in the db2jcc.jar / db2jcc4.jar file. I wanted to use this class to establish a connection to a DB2 Database, but I noticed a problem with that class.
So I wrote a very simple app which just instantiate a DB2SimpleDataSource class object,in this way:
     import android.app.Activity;
     import android.os.Bundle;
     import android.view.Menu;
     import android.view.MenuItem;
     import com.ibm.db2.jcc.DB2SimpleDataSource;
     public class MainActivity extends Activity {
     @Override
     protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main);
     DB2SimpleDataSource dataSource = new DB2SimpleDataSource(); //--->Error!
     }
Here's the problem:when I write this code,Eclipse shows no errors about this class,but when i run this app,it shows the following error in logcat:
 Could not find class 'com.ibm.db2.jcc.DB2SimpleDataSource' referenced 
 from method 'com.example.provadb2.MainActivity.onCreate'
Here's the process I used to add the JARs:
- Right click on project>Properties 
- From Java Build Path,in Libraries tab,i clicked "Add External JARs" and pointed to the db2jcc.jar file 
- In Order and Export tab,i checked db2jcc.jar 
I also tried unchecking in the Order and Export tab but nothing happened.
I also tried to use db2jcc4.jar file,without results.
The "funny" thing is that,when I wrote the same code in Java instantiating a DB2SimpleDataSource class object,it worked without errors...Hope i can find some help,thanks.
 
     
    