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