You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2005/10/27 16:54:50 UTC

cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer ConnectionFactoryPooledImpl.java

arminw      2005/10/27 07:54:50

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE 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
  No                   revision
  No                   revision
  1.15.2.9  +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.15.2.8
  retrieving revision 1.15.2.9
  diff -u -r1.15.2.8 -r1.15.2.9
  --- ConnectionFactoryPooledImpl.java	9 Oct 2005 23:51:01 -0000	1.15.2.8
  +++ ConnectionFactoryPooledImpl.java	27 Oct 2005 14:54:50 -0000	1.15.2.9
  @@ -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: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org