Hanna Hanna - 10 months ago 85
Java Question

SQLException: No suitable driver found for jdbc:derby

I've found this question before but non of the answers work for me!
I've got this error after running:

SQLException: No suitable driver found for

I've add derbyclient.jar to Library.but I didn't get any different result.I also don't want to create a new database.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String userid="a", password = "a";

// "jdbc:derby://localhost:1527//RIHANNA-PC/Users/javadb"
String url = "jdbc:derby://localhost:1527//RIHANNA-PC/Users/javadb";
Statement stmt;
Connection con;
String createString="select * from tbl_operator where user_id='" + jTextField1.getText() + "' and pwd='" + jTextField2.getText() + "'";
ResultSet rs;
try {
con=DriverManager.getConnection(url,userid, password);
stmt = con.createStatement();

tcb tcb
Answer Source

Do you load Derby JDBC driver? You can do it using the following java startup command:

java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver

For another way to load it see docs: http://db.apache.org/derby/docs/10.7/devguide/cdevdvlp40653.html