Hi Ilkka,

Done (CVS 1.0.x branch and trunk).
Thanks much!

regards,
Armin

Ilkka Priha wrote:
Hi,

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.

-- Ilkka


Index: ConnectionFactoryPooledImpl.java
===================================================================
RCS file: /home/cvspublic/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java,v
retrieving revision 1.15.2.8
diff -u -r1.15.2.8 ConnectionFactoryPooledImpl.java
--- ConnectionFactoryPooledImpl.java    9 Oct 2005 23:51:01 -0000 1.15.2.8
+++ ConnectionFactoryPooledImpl.java    27 Oct 2005 13:35:38 -0000
@@ -224,8 +224,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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to