I'm trying to get a log of the database activity to help debug a locking
problem. I have the derby database in a directory. In that directory I
have a derby properties file with the following contents:
derby.infolog.append=false
derby.language.logStatementText=true
derby.stream.error.logSeverityLevel=0
I run my application. I can see from the log4j trace that I've gone
through the code that adds records to the database 10 times. In the
directory that is the direct parent to the database directory, I see a
derby.log file. It contains the following:
----------------------------------------------------------------
2010-03-16 20:13:18.186 GMT:
Booting Derby version The Apache Software Foundation - Apache Derby -
10.4.2.0 - (689064): instance a816c00e-0127-689b-da4c-000007753e80
on database directory /u/aa/efhwff0/FM120100/FaultMgr
Database Class Loader started - derby.database.classpath=''
2010-03-16 20:14:07.872 GMT:
Shutting down instance a816c00e-0127-689b-da4c-000007753e80
----------------------------------------------------------------
Here is a code snippet for one instance where the database is updated.
private String addQuery =
"INSERT INTO FaultMgr.MEP_Events VALUES(DEFAULT, ?, ?,
?, ?)";
conn.setAutoCommit(false);
sqlPS = conn.prepareStatement(addQuery,
Statement.RETURN_GENERATED_KEYS);
SQLWarning sqlWarn = conn.getWarnings();
if (sqlWarn != null)
MEPErrorUtil.logSQLWarning(sqlWarn);
//Set values into the prepared SQL statement
sqlPS.setLong(1, dbTime);
sqlPS.setLong(2, nmbrOfDays);
sqlPS.setInt(3, event.length());
sqlPS.setString(4, event);
//Execute the query which adds the record to the database.
sqlPS.execute();
//Get generated key
ResultSet rs = sqlPS.getGeneratedKeys();
if (rs == null)
{
//Error handling code is here
}
conn.commit();
conn.setAutoCommit(true);
rs.close();
sqlPS.close();
I expected a log more in the log file. What am I doing wrong?
Walter Falby
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose it
to anyone else. If you received it in error please notify us immediately and
then destroy it.