Description:
Hi
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?
Teemu
How to repeat:
public class JDBCTest
{
public static void main(String[] args)
{
ResultSet rs = null;
Statement stmt = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=xxx&password=xxx&maxRows=1&profileSQL=true");
stmt = conn.createStatement();
System.out.println(stmt.getMaxRows());
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();}
}
}
Description: Hi 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? Teemu How to repeat: public class JDBCTest { public static void main(String[] args) { ResultSet rs = null; Statement stmt = null; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=xxx&password=xxx&maxRows=1&profileSQL=true"); stmt = conn.createStatement(); System.out.println(stmt.getMaxRows()); 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();} } }