Sqlexception: No Suitable Driver Found for Jdbc:Derby://Localhost:1527

SQLException: No suitable driver found for jdbc:derby

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

JAVA SQL - No suitable driver found for jdbc:derby

The issue is with the jar file.

Class.forName("org.apache.derby.jdbc.ClientDriver");

Check,

  1. Whether it is installed or not.
  2. If it is installed, is there a need to update your .bashrc file.
  3. Or, have you imported the .jar file in your netBeans IDE.

If all does not works, simply write a simple JDBC program to connect to Database using notpad & run it, check what is the problem with your machine.

No suitable driver found for jdbc:derby://localhost:1527/prosto

You will first need to load the derby driver class. To do that, add this code before the DriverManager.getConnection() call.

try{
Class.forName("org.apache.derby.jdbc.ClientDriver");// or may be it is "org.apache.derby.jdbc.EmbeddedDriver"? Not sure. Check the correct name and put it here.
} catch(ClassNotFoundException e){
//handle exception
}

This will load and register the Derby driver class in the JDBC's driver registry, after which you'll be able to connect to the database.

Refer to this for more details:

https://db.apache.org/derby/docs/10.4/devguide/cdevdvlp40653.html

Update

There should be a derbyclient.jar in the lib folder of derby installation. You will need to add that also to the class path and make it available at run time. This seems to solve the problem for me.

Hope this helps!

No suitable driver found for jdbc:derby: db-name error on JDBC with Java DB on Linux/Ubuntu

You are missing the load driver section of code

e.g.

String driver = "org.apache.derby.jdbc.EmbeddedDriver";
...
try {
Class.forName(driver);
} catch(java.lang.ClassNotFoundException e) {
...
}

see http://docs.oracle.com/javadb/10.8.3.0/getstart/rwwdactivity3.html for an example

Edit

As a proof I have done the following

  1. create simple java project in Eclipse
  2. add derby.jar, derbynet.jar & derbyclient.jat to classpath

My Code

public static void main(String[] args) {

String driver = "org.apache.derby.jdbc.EmbeddedDriver";
try {
Class.forName(driver);
} catch(java.lang.ClassNotFoundException e) {
e.printStackTrace();
}

final String DATABASE_URL = "jdbc:derby:myDB;create=true;user=user;password=pass";

try (
Connection connection = DriverManager.getConnection(DATABASE_URL, "user", "pass");
)
{
// ...
}
catch (SQLException sqlException)
{
sqlException.printStackTrace();
}

}

This runs without Exceptions

HIVE not working, No suitable driver found for jdbc:derby://localhost:1527

I switched to mysql as a metastore DB, setting up derby had already wasted a lot of my time. Here's the tutorial I followed saurzcode.in/2015/01/configure-mysql-metastore-hive/ .



Related Topics



Leave a reply



Submit