Hi Phil, thanks for your reply.
What kind of environmental data would be relevant ?
I do close the statement after retrieving the data rows. If it is a
memory issue, I cannot see it in "top" or in "vmstat".
Is there any db2 tool that might supply a better diagnostic ?
The origin application does not take the snapshot every 0.1 seconds,
and it still hanged. Only when I tried to isolate the problem, I
increased the frequency of the snapshot, to make sure that this is what
causes the database to hang.
Try putting your SQL statement into a file and using a shell script to
execute it. If you can run this without problems, you definitely have an
issue with the Java code interface.
A database snapshot will give you information about agents.
Check the APAR list from the most recent fixpack and look through it for
issues like yours. I believe that each fixpack's APAR list includes the
APARs repaired in prior fixpacks. If not, you'll need to check prior
fixpack APAR lists.
Make sure that your code does not do something like a connect for each
statement executed without corresponding disconnects.
Again, good luck
Phil Sherman
> Hi Phil, thanks for your reply.
>
[quoted text clipped - 8 lines]
> increased the frequency of the snapshot, to make sure that this is what
> causes the database to hang.
steingold@gmail.com - 30 Oct 2006 08:42 GMT
Well, I found some APAR's about snapshots that cause the database to
crash or hang (though neither one of them is about the snapshots that I
take), so I installed FixPak 13 which should contain the fixes for all
of these known bugs, but it still happens.
I attached the client that demonstrates the problem.
public static void main(String[] args) throws InterruptedException {
Connection con = null;
Statement statement = null;
ResultSet rs = null;
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
con = DriverManager.getConnection("jdbc:db2://server:50000/dbname",
"user", "pasword");
int i = 0;
while (true) {
statement = con.createStatement();
rs = statement
.executeQuery("SELECT * FROM TABLE (SNAPSHOT_LOCK (CAST (NULL AS
CHAR), -1)) AS LOCK_INFO");
if (rs.next()) {
System.out.println(rs.getString(1));
}
Thread.sleep(100);
i++;
rs.close();
rs = null;
statement.close();
statement = null;
}
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
try {
if (con != null)
con.close();
} catch (SQLException e) {
}
try {
if (statement != null)
statement.close();
} catch (SQLException e) {
}
try {
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}