Oracle JDBC driver

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Oracle JDBC driver

Postby iamok » Wed Nov 04, 2009 11:44 pm

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
iamok
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Nov 04, 2009 11:19 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests