[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - hsqldb sqlexception help
jboss_dev
do-not-reply at jboss.com
Tue Oct 30 13:21:11 EDT 2007
I am trying to use hsqldb in jboss-4.0.5.GA .I tried the following small jdbc code .
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
class JDBC_test
{
public static void main(String args[])
{
Connection conn=null;
Statement select=null;
try
{
Class.forName("org.hsqldb.jdbcDriver");
System.out.println("Driver loaded...");
}
catch(Exception e)
{
System.out.println("Failed to load hsql driver.");
return;
}
try
{
conn = DriverManager.getConnection("jdbc:hsqldb:file:db/anu","sa","");
System.out.println("connected to hsql..");
select = conn.createStatement();
System.out.println("after create statement..");
}
catch(Exception e) {System.out.println("create statement failed");}
try
{
ResultSet result = select.executeQuery("SELECT custid,firstname FROM customer_details");
System.out.println("Got results:");
while (result.next())
{ // process results one row at a time
int key = result.getInt(1);
String val = result.getString(2);
System.out.println("key = " + key);
System.out.println("val = " + val);
}
} catch (Exception e) {
e.printStackTrace();}
finally
{
if(conn!=null)
{
try { conn.close(); }
catch(Exception e){e.printStackTrace();}
}
}
}
}
I have a table customer_details created with few columns in the stand alone mode.
But I am getting the following error while running the code
Driver loaded...
connected to hsql..
after create statement..
java.sql.SQLException: Table not found in statement [SELECT custid,firstname FRO
M customer_details]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
at JDBC_test.main(JDBC_test.java:36)
Can anyone help me out with this error?
thanks and regards,
java_dev.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100376#4100376
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100376
More information about the jboss-user
mailing list