Not able to access the tables from H2 database using Java

2.1k Views Asked by At

I created a script for Database Testing using H2 database. I am facing issue, not able to read the tables in database. It throwing the message "Table not Found" and below code. But it is able to connect the database.

Configuration : h2-3.3.jar and h2.jar for Database Engine

Class.forName("org.h2.Driver"); 
Connection con=DriverManager.getConnection("jdbc:h2:file:C:\\keymanager\\etc\\H2/kms;CIPHER=AES","km_user","87654321 12345678");
System.out.println(con.getCatalog());
Statement statement = con.createStatement(); 
ResultSet resultSet1 = con.createStatement().executeQuery("SELECT * FROM KM_AUDITLOGS");
while(resultSet1.next()){
  System.out.println("CREATEDATE:" +resultSet1.getString("USERIP"));
}

After executing the Script error message has been displayed

"org.h2.jdbc.JdbcSQLException: Table KM_AUDITLOGS not found; SQL statement: SELECT * FROM KM_AUDITLOGS [42102-73]"

Any one can help me?

1

There are 1 best solutions below

0
On

When using the latest version of H2, it is working (according to the last comment).