arminw 2005/10/27 07:55:35
Modified: src/java/org/apache/ojb/broker/accesslayer
ConnectionFactoryPooledImpl.java
Log:
patch by Ilkka Priha
Handling of PreparedStatement during connection validation is invalid. The
fetch size is set first, but javadoc specifies that
PreparedStatement.setFetchSize(rows) may throw an exception if
0 <= rows <= this.getMaxRows()
Now, zero is the default for PreparedStatement.getMaxRows() and although its
meaning is an unlimited number of rows, Sun's JDBC/ODBC driver takes the spec
literally and throws an exception when the fetch size is set above zero without
first setting the max rows to at least the same size. So changing the order of
the fetch size and max rows settings fixes the query.
Revision Changes Path
1.23 +2 -2
db-ojb/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java
Index: ConnectionFactoryPooledImpl.java
===================================================================
RCS file:
/home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ConnectionFactoryPooledImpl.java 27 Aug 2005 12:05:04 -0000 1.22
+++ ConnectionFactoryPooledImpl.java 27 Oct 2005 14:55:31 -0000 1.23
@@ -236,8 +236,8 @@
try
{
stmt = conn.prepareStatement(query);
- stmt.setFetchSize(1);
stmt.setMaxRows(1);
+ stmt.setFetchSize(1);
rset = stmt.executeQuery();
if (rset.next())
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]