Here you can find the source of prepareStatement(Connection connection, String sql, boolean returnKeys, Object... values)
public static PreparedStatement prepareStatement(Connection connection, String sql, boolean returnKeys, Object... values) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; public class Main { public static PreparedStatement prepareStatement(Connection connection, String sql, boolean returnKeys, Object... values) throws SQLException { PreparedStatement statement = connection.prepareStatement(sql, returnKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS); setValues(statement, values);/*from w w w .ja va 2s. com*/ return statement; } public static void setValues(PreparedStatement statement, Object[] values) throws SQLException { for (int i = 0; i < values.length; i++) { statement.setObject(i + 1, values[i]); } } }