1

I have written a Java application which creates an H2 file database (1.4.184). It works fine on Windows and Ubuntu. When I deployed it to the Red Hat server, it creates the database but is unable to connect. It just hangs and doesn't exit with any exception. This is the bean-configuration, used by the application:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">  
    <property name="driverClassName"  value="org.h2.Driver"></property>  
    <property name="url" value="jdbc:h2:file:./db/h2/my_data_base"></property>
    <property name="username" value="username"></property>  
    <property name="password" value="password"></property>  
    <property name="defaultAutoCommit" value="false" />
</bean>

I first thought it might be something wrong with the configuration, but then I also tried out a simple connection-example http://www.h2database.com/ with the same result: When it should connect it starts hanging... (had it running already nearly an hour before terminating the process). I also found some issue with using: auto_server=true; but this doesn't apply in my case as I don't use it anyway. There is also no difference on the file permissions in comparison with Ubuntu.

Probably somebody has any idea what might cause this issue?

G.R
  • 65
  • 6

2 Answers2

0

This case happened to me once and what I did to solve this problem is to change the db locking mechanism to use socket. So, in your case, the url would be like this.

jdbc:h2:file:./db/h2/my_data_base;FILE_LOCK=SOCKET

you can check the detail in this url.

kucing_terbang
  • 4,991
  • 2
  • 22
  • 28
0

Ok - seems that there were some restrictions on the directory. Moved to a different one and it worked fine (though using the same file permissions).

G.R
  • 65
  • 6