Pass Array to JDBC Adapter

Hi All,

I’m trying to pass an array to the JDBC adapter. The input type is ARRAY (input field type java.sql.Array).

I’m trying to map String list to JDBC input or mapping object list to JDBC input in both cases it’s throwing following exception.

[ADA.1.340] The input data for field “empIds” is not “java.sql.Array”.
java.lang.String cannot be cast to java.sql.Array

I’ve written very simple custom SQL just trying to pass employee ids as string type.

SELECT e.empName from Employee e where e.empNo in (?)

So please could anyone help in mapping string list to java.sql.Array?

Somewhere in the JDBC Adapter user guide I read ‘The WHERE clause does not support the java.sql.Array data type’ and java.sql.Array or java.sql.Struct can be used as output field type for a database column of type array or struct only.

Hi,
I guess this could be resolved using a java service something like this…

java.sql.Array sqlArray = null;

try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url,userName,password);
sqlArray=conn.createArrayOf(“NUMBER”, content);
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “sqlarray”, sqlArray );
pipelineCursor_1.destroy();

    conn.close();
} catch (Exception e) {
    IDataUtil.put( pipelineCursor, "noconn", e);
}

The output sqlArray could be mapped to the adapter service input.

Regards,
Amol.

I have the same question but the response don’t work for me!
I don’t understant why i need a connection for have a java.sql.Array? It’s the only way?