Reputation: 41
I am using H2 for a Java Swing desktop application.
I cannot able to connect to the database, only in the server mode.
URL is : jdbc:h2:tcp://115.241.34.158:9092/Lion/Companies/1(2012-2013)/1(2012-2013);DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=5;IFEXISTS=TRUE
The system, simply hangs, while giving java.sql.DriverManager.getConnection(url, userName, password);
Not throwing any exception (or) any messages.
It works fine, in single user mode. (without server)
What will be the possible solution ?. Please advice.
Thanks and regards,
I.Murugesan
Upvotes: 0
Views: 198
Reputation: 50097
If you start the TCP server without base directory, then you should use a different database URL. The following database URL
jdbc:h2:tcp://115.241.34.158:9092/~/Lion/Companies
means the database file Companies.h2.db
is stored in the directory Lion
within the current user home directory. But if you use
jdbc:h2:tcp://115.241.34.158:9092/Lion/Companies/1(2012-2013)/1(2012-2013)
then the database file 1(2012-2013).h2.db
is stored in the directory Lion/Companies/1(2012-2013)
relative to the current working directory. And the working directory depends on where you have started the TCP server.
Upvotes: 1