gpt4 book ai didi

java - weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY 无法转换为 oracle.sql.ARRAY

转载 作者:行者123 更新时间:2023-12-01 20:15:36 30 4
gpt4 key购买 nike

我在 weblogic 中遇到错误:

java.lang.ClassCastException: weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY cannot be cast to oracle.sql.ARRAY at weblogic.jdbc.wrapper.CallableStatement_oracle_jdbc_driver_OracleCallableStatementWrapper.getARRAY(Unknown Source)

代码:

   public String[] methodName(String[] P1,String P2,String P3,String P4, String P5,int Sessioninfo)
{
Connection conn = null;
CallableStatement cstmt = null;
ResultSet rs = null;
String[] returnArray = null;

try {
ds=getDataSource(Sessioninfo);
conn = ds.getConnection();
conn = new CommonsDbcpNativeJdbcExtractor().getNativeConnection(conn);
conn.setAutoCommit(false);

ArrayDescriptor oracleVarchar2Collection =
ArrayDescriptor.createDescriptor("VARRAY_PARTS",conn);
ARRAY sqlNos = new ARRAY(oracleVarchar2Collection, conn, P1);

cstmt =conn.prepareCall("{call Procedure1(?,?,?,?,?,?)}");
cstmt.setObject(1, sqlNos);
cstmt.setString(2, P2);
cstmt.setString(3, WebpartsUtility.convertSQLStringIN(P3,","));
cstmt.setString(4, WebpartsUtility.convertSQLStringIN(P4,","));
cstmt.setString(5,P5);

cstmt.registerOutParameter(6,OracleTypes.ARRAY, "VARRAY_PARTS");

cstmt.setFetchSize(2500);
cstmt.execute();
ARRAY mainArray = ((OracleCallableStatement)cstmt).getARRAY(6);
returnArray = (String[]) mainArray.getArray();

} catch (SQLException ex) {
logger.fatalMsg("Sql Exception Occured :: "+ex.getMessage(),ex);
} catch (Exception ex) {
logger.fatalMsg("Exception Occured :: "+ex.getMessage(),ex);
} finally {
try {
if (cstmt != null) {
cstmt.close();
cstmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
if (ds != null) {
ds = null;
}
} catch (SQLException ex) {
logger.fatalMsg("Sql Exception Occured :: "+ex.getMessage(),ex);
} catch (Exception ex) {
logger.fatalMsg("Exception Occured :: "+ex.getMessage(),ex);
}
}

return returnArray;
}

最佳答案

数据源中的简单参数更改应该可以使其工作。

转到数据源 -> 选择数据源 -> 配置 -> 连接池 -> 高级,然后取消选中“包装数据类型”。

这应该可以解决问题。

关于java - weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY 无法转换为 oracle.sql.ARRAY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45859383/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com