Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Null Pointer Exception while trying to connect to Derby database

843859Mar 26 2008 — edited Mar 27 2008
Hello,
If anyone can help...it's so urgent
I'm not able to connect to my database
Everytime I get a nullpointerException at this point of my code:

Statement st=c.createStatement();
ResultSet rs=st.executeQuery(sql);

NB: I created the connection with:

private static String ODBCdriver="org.apache.derby.jdbc.ClientDriver";
private static Connection conn;

// Load the ODBC driver
try {
Class.forName(ODBCdriver);
conn = DriverManager.getConnection("jdbc:derby://localhost:1527/Carte_Menu","carte","cartemenu");
}

what should I do??why I get this exception??:(
(if this would help: I'm using netbeans 6.0 on Windows vista)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 24 2008
Added on Mar 26 2008
10 comments
5,421 views