I have an ArrayList of Strings in my code Java, and I need to send this list to my sp in Oracle. I can´t set the list, because Array it's not compatible with ArrayList. How can I send this list?
public static boolean ejecutarPackageSeteado(String procedimiento,ArrayList<String> lista) throws Exception{
try{
cs=getCallableStatement("{call "+procedimiento+"}");
cs.setArray(1,lista);//THIS LINE SHOW ERROR
cs.execute();
}catch(Exception e){
System.out.println(e.getMessage());
throw e;
}finally{
cs.close();
CallableStatementConnection.close();
}
return true;
}
This is my PrepareStatement
cs=getCallableStatement("{call "+procedimiento+"}");
//procedimiento is ="INSERTAR.INSERTAR_RUTFORZADA(?)"
private static CallableStatement getCallableStatement(String sql) throws Exception{
if(CallableStatementConnection==null || CallableStatementConnection.isClosed()){
CallableStatementConnection = getConnection();
}
return CallableStatementConnection.prepareCall(sql);
}