Inspectopedia
 
2024.3

Use of index 0 in JDBC ResultSet

Warning
New
Last modified: 03 December 2024

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: