Everywhere else in Java, anything with an index starts at 0. Is there a reason for the change here or is this just bad design?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Historically, databases have used 1-based indexing for bound parameters. This probably reflects the origins of relational databases in set theory and mathematics, which index elements starting with one, and use zero to represent a null or empty set.
In shell scripts and regular expressions, the zero index usually means something ‘special’. For example, in the case of shell scripts, the zeroth ‘argument’ is actually the command that was invoked.
The choice for JDBC was deliberate but, ultimately, probably causes more confusion and difficulty than it solves.