As
Sudhakar Shinde has given you the
documentation link[
^], from that link it is clear that...
Quote:
n
An int that indicates the parameter number.
x
A Date object.
Now refer one example -
PreparedStatement: setDate(int parameterIndex, Date x)[
^].
Here the query is specified like...
String query = "insert into date_table(id, date_column) values(?, ?)";
Where
id
,
date_column
are the parameters it is expecting.
And after that...
pstmt.setString(1, "0001");
java.sql.Date date = getCurrentJavaSqlDate();
pstmt.setDate(2, date);
Here 1 and 2 are the Parameter Index. Meaning
pstmt.setString(1, "0001");
implies to
id
and
pstmt.setDate(2, date);
implies to
date_column
of the query.
So, in your code
hist_sections.setDate(1, d);
, the query is expecting date parameter at position 1.
Hope you get the concept.