Sorry, this was an accidental duplicate. Ignore it as Armin has already kindly
applied the patch (although the explanation for the patch lacks one NOT, which
turns it upside down and falsely makes it to support the original order of set
statements).
-- Ilkka
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]