I have encountered this error in eclipse, attempting to connect to my database. I have looked at these suggestions:
SQLException: No suitable driver found for jdbc:derby://localhost:1527
However they all seem to suggest including derbyclient.jar into build path for your project, which I have.
java.lang.NoClassDefFoundError: org/apache/derby/jdbc/ClientDriver
at datasource.DBConnection.getDBConnection(DBConnection.java:38)
my database connection:
private static final String DB_CONNECTION = "jdbc:derby://localhost:1527/database;create=true";
private static Connection getDBConnection(){
try {
DriverManager.registerDriver(new org.apache.derby.jdbc.ClientDriver());
Connection dbConnection = DriverManager.getConnection(
DB_CONNECTION, DB_USER,DB_PASSWORD);
return dbConnection;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
System.out.println("Connection problem");
return null;
}