0
votes

I am trying to connect to Oracle database remotely I add the jar file as suggested in this link How can I use external JARs in an Android project? (most voted answer) The code as follows

public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    try{
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection connection = null;
        ......

when I debug, I found that it always throws exception at the Class.forName line

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

The jar file is from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html (ojdbc6.jar)

I looked for hours about it, any suggestions how to fix it.

Note: I tried the same code in normal java program - added the same jar file -in main method and it worked

1
I hope you've already read this: stackoverflow.com/questions/15853367/…Morrison Chang
very helpful thanks.john-salib

1 Answers

0
votes

Add your oracle library to the build path from eclipse by navigating to project properties and then add the external jar to your build path. Now you can load those classes in your project.