Bug #1933 Driver parameter maxRows does not work
Submitted: 24 Nov 2003 8:25 Modified: 13 Jan 2004 13:57
Reporter: Teemu Kuulasmaa Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S2 (Serious)
Version:3.0.9-stable & 3.1.1-alpha OS:Linux (Linux)
Assigned to: Mark Matthews CPU Architecture:Any

[24 Nov 2003 8:25] Teemu Kuulasmaa

I try to pass paramters to jdbc driver in connection url:
url = "jdbc:mysql://localhost:3306/test?user=xxx&password=xxx&maxRows=10&profileSql=true"

Option "profileSql=true" works but "maxRows=100" has no efect. All queries executed through the connection returns all rows and Statement.getMaxRows() 
returns "0". I expected that maxRows should give a new default value for 
newly created Statements. If I use Statement.setMaxRows() everything 
works fine.

Here is description of the "maxRows" parameter from the README file of the 
  jdbc driver:
maxRows             | The maximum number of rows to return      | 0
                     | (0 means return all rows)                 |

If this is not a real bug what is the real meaning of maxRows parameter? 


How to repeat:
public class JDBCTest 
	public static void main(String[] args) 
		ResultSet rs = null;
		Statement stmt = null;
			Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=xxx&password=xxx&maxRows=1&profileSQL=true");	
			stmt = conn.createStatement();
			rs = stmt.executeQuery("select * from test1");
			while ( rs.next() )
// There is two columns in the test1 table and we fetched all the columns
				System.out.println(rs.getObject(1) + ", " + rs.getObject(2));
		catch (SQLException e) {e.printStackTrace();}
		catch (InstantiationException e) {e.printStackTrace();} 
		catch (IllegalAccessException e) {e.printStackTrace();} 
		catch (ClassNotFoundException e) {e.printStackTrace();}		
[13 Jan 2004 13:57] Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

This is fixed for 3.0.10 and the nightly snapshots of 3.1.1.