I'm new to this site.
I've been having trouble connecting to my Java DB I have created. I've used the following code but given
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
as an error.
String url = "jdbc:derby://localhost:1527/db;create=true;user=Administrator";
String driver = "org.apache.derby.jdbc.ClientDriver";
// login and connection details above
try {
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
conn = DriverManager.getConnection(url);
Statement s = conn.createStatement();
System.out.println("connected!");
} catch (ClassNotFoundException | SQLException e) {
JOptionPane.showMessageDialog(null, "error in dbConnection " + e);
System.out.println(e.toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in DBconnection , consult developers!");
}
I've tried going through many forums and feeds and none of the advice given seems to work.