It only happens if I use the PreparedStatement.setInt(...) Using a statement like "SELECT * FROM PARTITIONED_B WHERE ID=" + m;
instead of "SELECT * FROM PARTITIONED_B WHERE ID=?"; preparedStetement.setInt(1, m); (which is more correct) works. If nobody has a clue I will report a bug in a couple of days... > -----Messaggio originale----- > Da: Leonardo Francalanci [mailto:[EMAIL PROTECTED] > Inviato: marted́ 22 giugno 2004 15.09 > A: Mysql > Oggetto: R: connectorJ & huge table problem > > > I have also weird results: > I access data by ID, which is a primary key in the table. > Some times (again, very random behaviour) I get 4 rows back > (instead of just 1) and the data I get is always > > 1275749989 > > This happens with random IDs. > > the code to check this is: > [..] > ResultSet rs = ps1.executeQuery(); > boolean c = false; > while (rs.next()) { > int g = rs.getInt(2); > if (c) { > // this shouldn't happen, because I'm selecting by ID, but it happens! > System.out.println(m + " " + g); > } > c = true; > } > > > -----Messaggio originale----- > > Da: Leonardo Francalanci [mailto:[EMAIL PROTECTED] > > Inviato: marted́ 22 giugno 2004 14.43 > > A: Mysql > > Oggetto: connectorJ & huge table problem > > > > > > I have a large table (64,000,000 rows). > > Everything was fine when the table was 16,000,000 rows, > > now connectorJ crashes: > > > > java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException: 6 > > at > > com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPrepa > > redStateme > > nt.java:908) > > at > > > com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1622) > > > > > > > > my code is: > > > > java.sql.Connection regularConn = > > ConnectionHandler.getRegularConnection(); > > > > java.sql.PreparedStatement ps1 = null; > > //letspartyConn.prepareStatement(query); > > for (int i = 0; i < 1000; i++) { > > String query = "SELECT * FROM PARTITIONED_B WHERE ID=?"; > > ps1 = regularConn.prepareStatement(query); > > int m = new Double(Math.random() * 64000000).intValue(); > > ps1.setInt(1, 12352597); > > ResultSet rs = ps1.executeQuery(); > > while (rs.next()) { > > int g = rs.getInt(2); > > } > > rs.close(); > > ps1.close(); > > > > } > > regularConn.close(); > > > > > > > > > > I debugged the code, and it seems to happen when it reads a long > > (readLongLong), > > but I don't have any data in my db that is long (everything is > int, and in > > fact > > every time the method readLongLong gets called it crashes). > > The error seems very random (sometimes happens, some others no, > and always > > with different IDs), > > I have no idea. > > > > Note that using the prepared statement in the proper way, that is: > > > > String query = "SELECT * FROM PARTITIONED_B WHERE ID=?"; > > ps1 = regularConn.prepareStatement(query); > > for (int i = 0; i < 1000; i++) { > > int m = new Double(Math.random() * 64000000).intValue(); > > ps1.setInt(1, 12352597); > > ResultSet rs = ps1.executeQuery(); > > while (rs.next()) { > > int g = rs.getInt(2); > > } > > rs.close(); > > } > > ps1.close(); > > regularConn.close(); > > > > > > everything works fine. Re-creating the PreparedStatement each > > time gives me > > the error > > above when I call ResultSet rs = ps1.executeQuery(). > > > > I'm using connectorJ 3.1.2, mysql 4.1.2 > > > > > > > > > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]