From: fredt <fr...@us...> - 2008-11-26 13:42:21
|
The file path "file:/home/shlahoti/DB/" in your URL doesn't look right. It shouldn't have a slash at the end. For troubleshooting, you can ";ifexists=true" to make sure you are connecting to an existing database. Fred ----- Original Message ----- From: "indian scorpio" <coo...@gm...> To: <hsq...@li...> Sent: 26 November 2008 12:57 Subject: [Hsqldb-user] jdbc hsqldb issue - table not found Hi When I try to connect using hsqldb DB Manager same link shows me the table and all queries work fine. Went through a couple of forums... but no solutions seems to work. Have also tried dbName as jdbc:hsqldb:file:/home/shlahoti/DB/;default_schema=true" (mentioned at a few places... Any other suggestions Facing following exception for public static Connection connectDB(String databaseName, String userName, String password) { Connection jdbcConnection = null; try{ Class.forName("org.hsqldb.jdbcDriver").newInstance(); jdbcConnection = DriverManager.getConnection(databaseName,userName,password); }catch(Exception ex) { String connectMsg = "Could not connect to the database: " + ex.getMessage() + " " + ex.getLocalizedMessage(); System.out.println(connectMsg); } return jdbcConnection; } public static void main(String[] args) { try{ String databaseName = "jdbc:hsqldb:file:/home/shlahoti/DB/"; String userName = "sa"; String password = ""; Connection jdbcConnection = connectDB(databaseName, userName, password); System.out.println(jdbcConnection); String query = "SELECT * FROM CUSTOMER"; Statement statmnt = jdbcConnection.createStatement(); ResultSet rs = statmnt.executeQuery(query); }catch(Exception e){ e.printStackTrace(); } java.sql.SQLException: Table not found: CUSTOMER in statement [SELECT * FROM CUSTOMER] at org.hsqldb.Trace.getError(Unknown Source) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |