I want to put an array of integers in my jdbc query with H2 database.
Integer[] list = new Integer[]{1,2,3};
String query = "SELECT EXAMPLE FROM DATA WHERE EXAMPLE IN (?)";
PreparedStatement ps = GestionBDD.getConexionBD().prepareStatement(query);
Array array = GestionBDD.getConexionBD().createArrayOf("int", list);
ps.setArray(1, array);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
// DO THINGS
}
But doest not work, I am getting this exception : org.h2.jdbc.JdbcSQLException: Data conversion error converting "(1,2,3)"; SQL statement:
I am using H2 database. Can you help me please?