File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Trouble with MySQL+TOMCAT Resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Trouble with MySQL+TOMCAT Resultset" Watch "Trouble with MySQL+TOMCAT Resultset" New topic
Author

Trouble with MySQL+TOMCAT Resultset

toum toum
Greenhorn

Joined: Nov 06, 2003
Posts: 1
I'm programming applets & servlets on Tomcat and MySQL with my desktop (PIII500 - Win2000 - 512Mo).
- jakarta-tomcat-4.1.27-LE-jdk14
- mysql-4.0.14b
- j2sdk1.4.2
- mysql-connector-java-3.0.9-stable
- Tomcat DBCP (collections-2.1 dbcp-1.0 pool-1.0.1)
But ! I can not have stable behaviour with ResultSet :
- Sometimes all records are returned. Fine !!!
- Sometimes, 0 (Zero) record is returned. Too bad !
- Sometimes, some (but not all) records are returned. Bad !
And, When all records are not returned, one of the two following exception types is raised :
java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:3601)
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:3614)
....
OR
java.lang.NullPointerException
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:3625)
at com.mysql.jdbc.ResultSet.getString(ResultSet.java:1772)
at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:137)
....
What my application does :
- Inserting rows in a table (strings, dates, integers).
- And the, selecting table in a Resultset for gettind data
- I use ResultSet.getString() for getting all fields.
Database Pooling configuration in server.xml file :
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>0</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>15000</value>
</parameter>
What I DO NOT suspect :
- Having not closed connection, statement or cursor.
- Doing some computation with null variables.
Thanks in advance for your help.
Toum.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Is MySQL transactional? Meaning if you have one session and you insert records, but don't commit, then wouldn't a sepertae session not see those records yet. Not much help, but an idea. Maybe it has to do with closing or not closing Connections correctly. But not much else to help since we don't see your code.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Trouble with MySQL+TOMCAT Resultset
 
Similar Threads
Tomcat connection pool exception: Closed Connection and Exhautsed Resultset
Cannot create JDBC driver of class '' for connect URL 'null',
Very slow to hook up to MySQL db
Datasource
DataSource Invalid