h2 (embedded mode ) database files problem
Posted
by aeter
on Stack Overflow
See other posts from Stack Overflow
or by aeter
Published on 2010-03-14T16:40:11Z
Indexed on
2010/03/14
16:45 UTC
Read the original article
Hit count: 416
There is a h2-database file in my src directory (Java, Eclipse): h2test.db
The problem:
starting the h2.jar from the command line (and thus the h2 browser interface on port 8082), I have created 2 tables, 'test1' and 'test2' in h2test.db and I have put some data in them;
when trying to access them from java code (JDBC), it throws me "table not found exception". A "show tables" from the java code shows a resultset with 0 rows.
Also, when creating a new table ('newtest') from the java code (CREATE TABLE ... etc), I cannot see it when starting the h2.jar browser interface afterwards; just the other two tables ('test1' and 'test2') are shown (but then the newly created table 'newtest' is accessible from the java code).
I'm inexperienced with embedded databases; I believe I'm doing something fundamentally wrong here. My assumption is, that I'm accessing the same file - once from the java app, and once from the h2 console-browser interface. I cannot seem to understand it, what am I doing wrong here?
© Stack Overflow or respective owner