Reputation: 65
I am using Hibernate with HSQL DB. I have a file-based HSQL database called "testdb".
When I try to connect to my HSQL file-string URL, my application hangs.
It hangs right after this Hibernate output:
INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:file:testdb
INFO: connection properties: {user=SA, password=****}
Note that the problem does not happen with In-Memory HSQL. If the URL is "jdbc:hsqldb:mem:testdb" everything works. So it's a File setting issue.
I verified in Hibernate that the DB exists, the HSQL file exists, I have my tables there and can browse them.
In fact, even when I specify a non-existent file in File:, it still hangs. What am I doing wrong? Thanks
My hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:file:testdb</property>
<property name="connection.username">SA</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>
</session-factory>
</hibernate-configuration>
Upvotes: 1
Views: 2843
Reputation: 1981
The database has huge tables, it takes time to fetch the database objects.
Upvotes: 0
Reputation: 24352
When the first connection attempt tries to open the database, it creates a .lck file. This file contains a regularly updated timestamp and prevents other processes connecting to the database at the same time. It does not prevent connection if no other database is connected. Therefore you needn't delete the .lck file.
If during a connection attempt the .lck file is not created, it indicates no connection has been made. There may be issues with file access permissions.
You can always check the database itself by connection with the GUI DatabaseManager.
Upvotes: 1