Back to Intellij Community

ResultSetIndexZero

java/java-impl/resources/inspectionDescriptions/ResultSetIndexZero.html

2025.3-rc-2389 B
Original Source

Reports attempts to access column 0 of java.sql.ResultSet or java.sql.PreparedStatement. For historical reasons, columns of java.sql.ResultSet and java.sql.PreparedStatement are numbered starting with 1 , rather than with 0 , and accessing column 0 is a common error in JDBC programming.

Example:

String getName(ResultSet rs) {
    return rs.getString(0);
  }