import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ public class ReproduceError { public static void main(String[] args) throws Exception { Properties props = new Properties(); props.put("user", "mySQL64621"); props.put("password", "1234"); //props.put("useServerPrepStmts","true"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/mySQL64621", props); connection.setAutoCommit(false); connection.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); PreparedStatement query = connection.prepareStatement("SELECT * FROM test", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); query.setFetchSize(Integer.MIN_VALUE); query.getMetaData(); // causes OutOfMemoryException } }