I recently shutdown this H2 database and after restarting the service, I 
can no longer connect via TCP. I've been troubleshooting from command line; 
the web interface just times out. Here's what I see:

java -cp  /home/rules/h2/bin/h2-1.3.169.jar org.h2.tools.Shell -url 
jdbc:h2:tcp://localhost//home/rules/care -user sa

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Connection is 
broken: "java.net.ConnectException: Connection refused: localhost" 
[90067-169]
        at 
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
        at org.h2.message.DbException.get(DbException.java:158)
        at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:399)
        at 
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:287)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:109)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:93)
        at org.h2.Driver.connect(Driver.java:72)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:215)
        at org.h2.tools.Shell.runTool(Shell.java:144)
        at org.h2.tools.Shell.main(Shell.java:80)
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at org.h2.util.NetUtils.createSocket(NetUtils.java:119)
        at org.h2.util.NetUtils.createSocket(NetUtils.java:100)
        at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:93)
        at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:395)
        ... 8 more

However, it is possible to connect using the file protocol:

java -cp  /home/rules/h2/bin/h2-1.3.169.jar org.h2.tools.Shell -url 
jdbc:h2:file://home/rules/care -user sa

This is fortunate, because this is a production system and we were able to 
get the application running again by changing the connection string.

How do I troubleshoot this? I can't find any log files or places where 
there would be useful startup messages logged.
  for each startup, one line in /var/log: "Web Console server running 
at...", and
  the trace file is full of "01-10 09:39:03 pageStore: Transaction log 
could not be truncated; size: 16 MB" 

I am not familiar with H2; I am approaching this from an operations 
perspective; more familiar with mysql and MSSQL server. My intuition is 
that somewhere, there is a file that is locking the connection from when 
the server was last shutdown. We need a clean restart.

More background that might be helpful: the reason for the shutdown/restart 
etc. was that the database file had grown to 2.5GB in size. A backup and 
restore to another server resulted in a 40MB file. I suspect the 
transaction logs (whereever they might be?) grew out of control and needed 
to be truncated. I had hoped to shutdown compact, but I did not even get 
that far; a simple shutdown led to the current situation.

I was able to shrink the database eventually by deleting the database file 
and copying over a test database to replace it. Then, I was able to connect 
with file method above and restore a backup. The current database file size 
is only 92MB.


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to