I can't get Hibernate to disconnect from the database once it is connected.
It creates a HSQLDB.lck file and I have to terminate the Tomcat before I can
access it again.
I have tried: (With no luck..)
try {
Configuration cfg = new
Configuration().configure("/hibernate-HSQLDB.cfg.xml");
SessionFactory sessions = cfg.buildSessionFactory();
Long user = new Long(0);
AuditInterceptor aii = new AuditInterceptor(user);
session = sessions.openSession(aii);
sw.start();
list = session.find("from " + table + " in class " +
StringUtils.capitalise(table));
// Edited by tmckinnon: 20-Jan-2004 03:56:27 PM PST
// trying to get HSQLDB lck to release...
if(session != null && session.isOpen()) {
Connection con = session.connection();
Statement st = con.createStatement();
st.execute("SHUTDOWN COMPACT");
con.commit();
st.close();
con.close();
logger.trace("Shut down HSQLDB session!");
session.disconnect();
if(session != null) session.close();
}
hibernate.push(list.toArray(new Object[list.size()]), clazz);
} catch(Exception e) {
throw e;
} finally {
try {
if(session != null && session.isOpen()) {
logger.trace("Closing CSV session!");
session.disconnect();
if(session!=null) session.close();
}
} catch(Exception e) {
logger.trace("Error trying to close session");
throw e;
}
}
but just get:
16:20:06,032 WARN [http8100-Processor4]
net.sf.hibernate.util.JDBCExceptionReporter:38 - SQL Error: -33, SQLState:
null
16:20:06,032 ERROR [http8100-Processor4]
net.sf.hibernate.util.JDBCExceptionReporter:46 - Access is denied in
statement [SHUTDOWN COMPACT]
16:20:06,042 ERROR [http8100-Processor4]
net.sf.hibernate.util.JDBCExceptionReporter:38 - Cannot close connection
java.sql.SQLException: Access is denied in statement [SHUTDOWN COMPACT]
at org.hsqldb.jdbcResultSet.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.executeStandalone(Unknown Source)
at org.hsqldb.jdbcConnection.execute(Unknown Source)
at org.hsqldb.jdbcConnection.rollback(Unknown Source)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnection.reset(C3P0PooledConnection.jav
a:251)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnection.access$000(C3P0PooledConnectio
n.java:35)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnection$ProxyConnectionInvocationHandl
er.doSilentClose(C3P0PooledConnection.java:531)
at
com.mchange.v2.c3p0.impl.C3P0PooledConnection$ProxyConnectionInvocationHandl
er.invoke(C3P0PooledConnection.java:636)
at com.mchange.v2.c3p0.impl.$Proxy0.close(Unknown Source)
at
net.sf.hibernate.connection.C3P0ConnectionProvider.closeConnection(C3P0Conne
ctionProvider.java:40)
at net.sf.hibernate.impl.BatcherImpl.closeConnection(BatcherImpl.java:275)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3299)
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel