Good Morning everyone,
I have an issue trying to get my database working. I'm working with Eclipse and Apache Derby 10.12.1.1. When I'm in the Database Developement Perspective I have no trouble connecting to my database and editing my table. Picture of Connected DB
To connect to the Database I use the Derby Embedded JDBC Driver Version 10.2. But when I try to access my Database from a java program it gives me an SQLException: no suitable driver found. Here is my code:
public class Test3 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Connection connection = DriverManager.getConnection("jdbc:derby:.../DB/db;create=false");
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM USERS WHERE USERS.USERID = 123456");
int i = 1;
while (rs.next()) {
System.out.println(i + ": " + rs.getString(1) + ", " + rs.getString(2));
i++;
}
stmt.close();
connection.close();
}
}
and the ErrorMassage looks like this:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:derby:.../DB/db;create=false
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
at scraping/other.Test3.main(Test3.java:12)
Can someone help me?
Kind Regards,
Patty23
My Problem was solved by adding the driver to the Build Path of the Javaproject.
Kind regards, Patty23