-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Running SchemaExport gives SQLException Database in use
PostPosted: Wed Sep 06, 2006 11:47 pm 
Newbie

Joined: Wed Sep 06, 2006 11:11 pm
Posts: 1
I've written some code to automatically create the db tables if they are not present.

What it basically does is this:

1) Setup the hibernate Configuration
2) Call buildSessionFactory() to get a session factory
3) Attempt a simple query on the db
4) if the query fails, use SchemaExport.create() using the same hibernate config to create the tables

This was working fine. In the production code it's used fairly rarely, but the unit tests depend on it. All of the sudden this stopped working and now I get an exception when trying the SchemaExport. It seems to be complaining that the HSQL DB is already in use, presumably because of the query I tried before the SchemaExport.

I've spent a couple of days trying to figure out what changed with no success. I've tried issuing a SHUTDOWN to the db with mixed results. Also tried adding the hibernate.connection.shutdown property to the configuration.

Has anybody ever seen something like this before? The really mystifying part is that it used to work just fine and stopped all of the sudden.

Thanks,
Fabian

Hibernate version:
I believe we're still using Hibernate 2.


Full stack trace of any exception that occurs:
java.sql.SQLException: The database is already in use by another process: org.hsqldb.NIOLockFile@977267fd[file =C:\eclipse3.2\junit-workspace\holdings_db.lck.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: The process cannot access the file because another process has locked a portion of the file : C:\eclipse3.2\junit-workspace\holdings_db.lck.lck
at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:66)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:76)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:66)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:787)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:548)
at com.mchange.v2.resourcepool.BasicResourcePool.access$000(BasicResourcePool.java:35)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:972)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:148)



Name and version of the database you are using:
HSQL 1.7






      Top
       Profile  
       
       Post subject:
      PostPosted: Thu Sep 07, 2006 4:21 pm 
      Hibernate Team
      Hibernate Team

      Joined: Tue Aug 26, 2003 6:10 am
      Posts: 8615
      Location: Neuchatel, Switzerland (Danish)
      hsqldb issue .... or you are holding on to some session/connection so the db is not shut down.

      to avoid all these issues run with the standalone remove version

      _________________
      Max
      Don't forget to rate


      Top
       Profile  
       
      Display posts from previous:  Sort by  
      Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

      All times are UTC - 5 hours [ DST ]


      You cannot post new topics in this forum
      You cannot reply to topics in this forum
      You cannot edit your posts in this forum
      You cannot delete your posts in this forum

      Search for:
      © Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.