Hi,
Can anyone see whats wrong with this.
Im using DB Unit with HSQL Memory based database but I'm having trouble trying to get it to recognise the driver.
I have used this driver with another class to connect to the database, run queries etc and it works fine and its the same as in examples on the internet.
Thanks for the help
Dexter
Stack Trace
Can anyone see whats wrong with this.
Im using DB Unit with HSQL Memory based database but I'm having trouble trying to get it to recognise the driver.
I have used this driver with another class to connect to the database, run queries etc and it works fine and its the same as in examples on the internet.
Thanks for the help
Dexter
Code:
protected IDatabaseConnection getConnection() throws Exception
{
String driver = "org.hsqldb.jdbcDriver";
String protocol = "jdbc:hsqldb:mem:";
try
{
Class driverClass = Class.forName("org.hsqldb.jdbcDriver");
Connection jdbcConnection = DriverManager.getConnection("jdbc:hsqldb:mem:sample", "sa", "");
return new DatabaseConnection(jdbcConnection);
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
protected IDataSet getDataSet() throws Exception
{
String[] tableNames = {"TestTable1", "TestTable2"};
IDataSet loadedDataSet = getConnection().createDataSet(tableNames);
return loadedDataSet ;
}
Stack Trace
Code:
org.hsqldb.jdbcDriver
java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.distocraft.dc5000.dwhm.DatabaseTest.getConnection(DatabaseTest.java:140)
at org.dbunit.DatabaseTestCase.newDatabaseTester(DatabaseTestCase.java:66)
at org.dbunit.DatabaseTestCase.getDatabaseTester(DatabaseTestCase.java:79)
at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:116)