Use of index 0 in JDBC ResultSet
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);
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023