Hi all
I am trying to reach an Oracle 11g database from my Android phone.
I believe my application throws the "ClassNotFound" exception as soon
as I try to load the Oracle JDBC driver.
Im using Eclipse to develop the app. I have already added a reference to the
driver (Build Path > Configure Build Path > Referenced Libraries > Add External
Jars). The statement producing the exception is:
Class.forName("oracle.jdbc.OracleDriver");
Thanks
This is the code Im trying to execute:
/////////////////////////////////////////////////////////////////////////////
package cis612.jdbcdatabase;
import java.sql.Connection;
import java.sql.SQLException;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import oracle.jdbc.*;
public class JDBCAndroid extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
callOracleDatabase();
} catch (SQLException e) {
Toast.makeText(this, e.getMessage(), 1).show();
} catch (ClassNotFoundException e) {
Toast.makeText(this, e.getMessage(), 1).show();
}
}
public void callOracleDatabase() throws SQLException,
ClassNotFoundException {
// Load the Oracle JDBC driver
Class.forName("oracle.jdbc.OracleDriver");
Toast.makeText(getApplicationContext(), "Gotit", 1).show();
}//callDatabase
}//class

