Hi ,
I'm trying to execute some queries on a Derby JDBC, the problem is that I cannot connect to it, here is the exception message:
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/COREJAVA;create=true
and the connection method code:
public static Connection getConnection() throws SQLException, IOException
{
Properties props = new Properties();
FileInputStream in = new FileInputStream("d:\\database.properties");
props.load(in);
in.close();
String drivers = props.getProperty("jdbc.drivers");
if (drivers != null) System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return DriverManager.getConnection(url, username, password);
}
now the d:\\database.properties file (how can I use a relative path ?? if I put it in the same folder as the source file it doesn't recognize it) contains:
#jdbc.drivers=org.apache.derby.jdbc.ClientDriver
jdbc.url=jdbc:derby://localhost:1527/COREJAVA;create=true
jdbc.username=dbuser
jdbc.password=secret
and the driver Derby.jar is in D:\Program Files\derbyDB\lib
I'm using NetBeans 6.8 IDE
THNX ALOT