Results 1 to 8 of 8
Thread: can't load the driver (hsqldb)
- 05-23-2009, 11:15 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 32
- Rep Power
- 0
can't load the driver (hsqldb)
hi,
i have a strange problem..this code worked well until today..i haven't changed anything so i dont know why doesn't work anymore...
and the error message:Java Code:import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class TestDemobase { static String database = "/bsp/database"; static String sql = "SELECT * FROM Bookmarks"; static String sql1 = "SELECT url FROM Bookmarks"; static String sql2 = "INSERT INTO Bookmarks VALUES('Pythoni', 'www.pythoni.com');CHECKPOINT"; static Connection connection; public static void main(String[] args) throws Exception { System.out.println("TestDemobase 1\n"); Class.forName("org.hsqldb.jdbcDriver"); connection = DriverManager.getConnection("jdbc:hsqldb:" + database, "sa", ""); Statement statement = null; ResultSet resultSet = null; statement = connection.createStatement(); resultSet = statement.executeQuery(sql); while (resultSet.next()) { System.out.println(resultSet.getString("title") + " (" + resultSet.getString("url") + ")"); } System.out.println("\nTestDemobase 2\n"); resultSet = statement.executeQuery(sql1); while (resultSet.next()) { System.out.println(" (" +resultSet.getString("url") + ")"); } System.out.println("\nTestDemobase 3\n"); resultSet = statement.executeQuery(sql2); //statement.executeUpdate("INSERT INTO Bookmarks " + "VALUES('Pythoni', 'www.pythoni.com')"); System.out.println("TestDemobase 1\n"); resultSet = statement.executeQuery(sql); while (resultSet.next()) { System.out.println(resultSet.getString("title") + " (" + resultSet.getString("url") + ")"); } resultSet.close(); statement.close(); connection.close(); } }
Java Code:TestDemobase 1 Exception in thread "main" java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at TestDemobase.main(TestDemobase.java:17)
thx in advance for ur help
tomiou
- 05-24-2009, 02:36 AM #2
Well something must have changed. The classloader can't find the driver classes any more.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-28-2009, 07:39 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 32
- Rep Power
- 0
but i didn't change anything...i just dont know why the code worked before and doesn't work anymore...the code compiles fine with no error, but when i run it the classloader can't find the driver...
Last edited by tomiu; 05-28-2009 at 07:43 PM.
- 05-28-2009, 08:47 PM #4
Then the driver files got moved or you changed your classpath or execution method. Things don't magically become broken for no reason.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-29-2009, 02:41 AM #5
It's a dang conspiracy !!!
Yes, they do. That's why Gremlins were invented... they do this kind of stuff all the time and sometimes they even buddy up with Murphy to make things worse.:)Things don't magically become broken for no reason.
CJSLLast edited by CJSLMAN; 05-29-2009 at 03:08 PM. Reason: add smilely face
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 05-29-2009, 04:21 AM #6
Whether it was you or the Gremlins that changed something, something still got changed.
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-29-2009, 10:47 PM #7
Member
- Join Date
- Dec 2008
- Posts
- 32
- Rep Power
- 0
i still can't find what got changed...all i did was: SHUT DOWN the PC and the next day showed this error...i didn'T install new software, i didn't deinstalled anything...i checked hsqdlb.jar is in my classpath, so no change there too...
i'll post this problem in other forums and if i find the solution i'll post it here too
- 06-09-2009, 11:23 PM #8
Member
- Join Date
- Sep 2008
- Posts
- 16
- Rep Power
- 0
Similar Threads
-
load driver in javaDB
By kulangotski in forum New To JavaReplies: 1Last Post: 02-20-2009, 07:15 PM -
Configure HSQLDB in RedHatEnterpriseLinux 4
By vrk in forum JDBCReplies: 0Last Post: 02-13-2009, 06:44 AM -
PostgreSQL driver
By bugger in forum JDBCReplies: 3Last Post: 01-11-2008, 09:45 AM -
Help with JDBC driver
By Daniel in forum JDBCReplies: 2Last Post: 07-03-2007, 08:16 PM -
Oracle Driver
By softy in forum JDBCReplies: 1Last Post: 07-02-2007, 12:20 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks