Hi Jeff,
Thanks for the suggestion and code. I have tried this and Tomcat still
holds the database. I know this because I have a program from Sysinternals
that lists the files held by a process and the database is one of them. But
here is the weird part. After some amount of time, the database does get
released. I am lost at this point. Any more suggestions?
Thanks,
Kevin
Kevin Andryc
Web Systems Engineer
MISER
http://www.umass.edu/miser/
Phone: (413)-545-3460
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 01:54 PM
To: Tomcat Users List
Subject: Re: Database locked by Tomcat
Hi, Kevin.
Correction: Database locked by YOU! :)
You've closed the statement but not the connection. You need a conn.close()
after the commit. This shouldn't lock the database by itself, although if
you
keep leaving connections open, then you will eventually hit a connection max
limit, which could be what's hanging it. I would also recommend that you
put
all that stuff in a try block and finally close the connection, something
like
this:
Statement stmt = null;
Connection conn = DriverManager.getConnection(dbfUrl, "", "");
try {
// do some stuff
conn.commit();
}
catch(Exception e) {
conn.rollback();
}
finally {
if ( stmt != null ) {
try {
stmt.close();
}
catch(SQLException e) {
// handle or ignore
}
}
conn.close();
}
HTH,
Jeff
Kevin Andryc
<kandryc@miser. To: Tomcat Users List
<[EMAIL PROTECTED]>
umass.edu> cc:
Subject: Database locked by
Tomcat
06/11/02 12:44
PM
Please respond
to "Tomcat
Users List"
I am Running Tomcat 4.0 on Windows 2000. I have a servlet, which calls a
program that connects to a DBF database natively (not using JDBC-ODBC) and
updates records in the database. The problem I am having is that Tomcat does
not release the database until I restart the Tomcat service. I close the
connection and even do a "commit()". Has anyone else had a problem and if
so, is there a solution? Below is some sample code:
Class.forName(dbfDriverName).newInstance();
Connection conn = DriverManager.getConnection(dbfUrl, "", "");
Statement stmt = conn.createStatement();
// do some stuff
statement.close();
connection.commit();
Thanks,
Kevin
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>