How do I pass an array of timestamps to the Postgres function using Java and JDBC?
Here's the signature of the function:
CREATE OR REPLACE FUNCTION getlistcount(_id integer, _subs text, _download_array timestamp without time zone[], _filter integer, _fault text) RETURNS refcursor AS...
Here is the Java code that creates the array:
GregorianCalendar[] dataDownloads =
downloadTimes.toArray(new GregorianCalendar[downloadTimes.size()]);
Array sqlArray = conn.createArrayOf("timestamp", dataDownloads);
cstmt.setArray(4, sqlArray);
The downloadTimes are List passed into the Java function.
One hint: we need to concatenate the time with the date, according to the Postgres documentation.