Reputation: 539
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 jdbc:derby://localhost:1527//RIHANNA-PC/Users/javadb
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();
rs=stmt.executeQuery(createString);
Upvotes: 0
Views: 4309
Reputation: 329
I met the same question. If you want to connect the javadb by netwrok,you should be startNetworkServer,and create the database in this status.
And the driver is "org.apache.derby.jdbc.ClientDriver"
Upvotes: 0
Reputation: 2824
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
Upvotes: 0