Bug 8564 - keysSql not formatted for DB2 database
Summary: keysSql not formatted for DB2 database
Status: RESOLVED DUPLICATE of bug 7170
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 4.0.3 Final
Hardware: All other
: P3 blocker (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-04-26 18:49 UTC by John Sandberg
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description John Sandberg 2002-04-26 18:49:42 UTC
In the class org.apache.catalina.sessions.JDBCStore which I am using for 
storing persistent sessions to a DB2 database, the SQLSTATE 42803 error came up 
as a COM.ibm.db2.jdbc.DB2Exception was thrown.  I traced the problem back to 
the JDBCStore source, line 390, where the following statement is issued:

String keysSql = "SELECT COUNT(s."+sessionIdCol+"), s."+sessionIdCol+" 
FROM "+sessionTable+" s, " +sessionTable+" c" +" GROUP BY c."+sessionIdCol;

This statement was throwing the error in DB2, so I replaced it with:

String keysSql = "SELECT COUNT(s."+sessionIdCol+"), s."+sessionIdCol+" 
FROM "+sessionTable+" s" +" GROUP BY s."+sessionIdCol;

I asked a DB2 expert at my company and he said that because of the higher level 
of error checking in DB2 as compared to other databases, the format of this 
statement was incorrect.  With this fix, I no longer get the Exception.
Comment 1 Remy Maucherat 2002-04-29 06:56:04 UTC
This has already been fixed.

The statement should be:
        String keysSql =
            "SELECT COUNT(s."+sessionIdCol+"), c."+sessionIdCol+
            " FROM "+sessionTable+" s, "+sessionTable+" c"+
            " GROUP BY c."+sessionIdCol;

*** This bug has been marked as a duplicate of 7170 ***