Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

Spring stored procedure on WebSphere Server - ClassCastException

$
0
0
I am trying to pass ARRAY object to stored procedure as below. I am using websphere for my code execution where I get datasource through JNDI.

Code:

private class DeleteActorsProc extends StoredProcedure {

        public DeleteActorsProc(DataSource dataSource) {
            super(getDataSource(), "delete_actors");
            declareParameter(
                new SqlParameter("in_actor_ids", OracleTypes.ARRAY, "ACTOR_ID_ARRAY"));
        }

        public void execute(Long[] ids) {
            Map in = Collections.singletonMap("in_actor_ids", new SqlArrayValue(ids));
            Map out = this.execute(in);
        }

    }

While executing the code, I am getting below error.

HTML Code:

Caused by: java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection
        at oracle.sql.TypeDescriptor.setPhysicalConnectionOf(TypeDescriptor.java:310)
        at oracle.sql.TypeDescriptor.<init>(TypeDescriptor.java:106)
        at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:247)
        at org.springframework.data.jdbc.support.oracle.SqlArrayValue.createTypeValue(SqlArrayValue.java:90)
        at org.springframework.jdbc.core.support.AbstractSqlTypeValue.setTypeValue(AbstractSqlTypeValue.java:58)
        at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:275)
        at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
        at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)

Please advise me how to proceed. I tried using NativeJdbcExtractor, but as far I understand, I need Oracle Datasource for this. Let me know how can i get Oracle Datasource from this class or is there any other way for resolving.

Your inputs will help me a lot.

Thank you.

Viewing all articles
Browse latest Browse all 297

Trending Articles