简体   繁体   中英

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 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);

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM