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,
- Whether it is installed or not.
- If it is installed, is there a need to update your .bashrc file.
- 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
- create simple java project in Eclipse
- 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
How to Set the Default Locale in the Jvm
Cut Out Image in Shape of Text
Scale the Imageicon Automatically to Label Size
Update Jlabel Every X Seconds from Arraylist<List> - Java
How to Know If Other Threads Have Finished
Remove Diacritical Marks (Ń Ǹ Ň ñ Ṅ Ņ Ṇ Ṋ Ṉ ̈ Ɲ Ƞ ᶇ ɳ ȵ) from Unicode Chars
How to Supply Value to an Annotation from a Constant Java
How to Read a Specific Line Using the Specific Line Number from a File in Java
Why Can't Overriding Methods Throw Exceptions Broader Than the Overridden Method
How Does the String Class Override the + Operator
How to Call the Default Deserializer from a Custom Deserializer in Jackson
How to Deploy a Javafx 11 Desktop Application with a Jre
Java.Lang.Classnotfoundexception: Com.Mysql.Jdbc.Driver in Eclipse
How to Import a Class from Default Package
Why Does Runtime.Exec(String) Work for Some But Not All Commands