1

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

JDBC Derby driver not found

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;

}
zabop
  • 6,750
  • 3
  • 39
  • 84
Callum
  • 154
  • 1
  • 6

0 Answers0