How to set list of parameters on prepared statement?
java, jdbc, postgresql, prepared-statement
Solution
There's no clean way to do this simply by setting a list on the `PreparedStatement` that I know of.
Write code that constructs the SQL statement (or better replaces a single ? or similar token) with the appropriate number of questions marks (the same number as in your list) and then iterate over your list setting the parameter for each.
Problem
i have a list of names e.g.: ``` List<String> names = ... names.add('charles'); ... ``` and a statement: ``` PreparedStatement stmt = conn.prepareStatement('select * from person where name in ( ? )'); ``` how to do the following: ``` stmt.setParameterList(1,names); ``` Is there a workaround? can someone explain why this method is missing? using: java, postgresql, jdbc3