问题描述
JDBC方式调用oracle存储过程,存储过程有个自定义类型的参数,如下为代码段,标红那行转换后之后,在TOMCAT下面正常,部署到weblogic下面,转换结果为乱码,我们按照网上的说法,替换过两个包:nls_charset12.jar、orai18n.jar,问题仍然没能解决,求大礼解答!ARRAY是oracle.sql.ARRAY这个类。publicStringSp_wms_transfer(StringsBillno,StringcustomerID,StringtransferTime,Stringreason,StringreasonCode,StringsiteNo,StringmdfId,StringmdfDate,String[][]transferTypeArrayList){intrtnCode=-1;StringrtnMsg="";StringTRANSFER_TYPE_ARRAY="SHOP88.TRANSFER_TYPE_ARRAY";Stringprocedure="{callSP_WMS_TRANSFER(?,?,?,?,?,?,?,?,?,?,?)}";try{conn=this.getDBConnection();//获取数据库链接发生异常,直接返回if(null==conn)returnrtnMsg;proc=conn.prepareCall(procedure);proc.setString(1,sBillno);proc.setString(2,customerID);proc.setString(3,transferTime);proc.setString(4,reason);proc.setString(5,reasonCode);proc.setString(6,siteNo);proc.setString(7,mdfId);proc.setString(8,mdfDate);//创建一个数组描述符ArrayDescriptorvarchar2Desc=ArrayDescriptor.createDescriptor(TRANSFER_TYPE_ARRAY,conn);//将字符串数组转换为oralce能识别的数组ARRAYvArray=newARRAY(varchar2Desc,conn,transferTypeArrayList);proc.setArray(9,vArray);proc.registerOutParameter(10,Types.BIGINT);proc.registerOutParameter(11,Types.VARCHAR);proc.execute();rtnCode=proc.getInt(10);rtnMsg=proc.getString(11);if("0".equals(String.valueOf(rtnCode)))rtnMsg="0操作成功(0):"+rtnMsg;elseif("9".equals(String.valueOf(rtnCode)))rtnMsg="9单据已处理(9):"+rtnMsg;elsertnMsg="1操作失败("+String.valueOf(rtnCode)+"):"+rtnMsg;}catch(Exceptione){//记录异常日志StringinterfaceName="sp_wms_transfer_exce";//拼接参数Stringdata="header:"+sBillno+","+customerID+","+transferTime+","+reason+","+reasonCode+","+siteNo+","+mdfId+","+mdfDate+";detail:";for(inti=0;i<transferTypeArrayList.length;i++){data+=("item"+(i+1)+":");for(intj=0;j<transferTypeArrayList[i].length;j++){data+=(transferTypeArrayList[i][j]);data+=(j==transferTypeArrayList[i].length-1)?";":",";}}Stringkey=sBillno;this.recordExceLog(interfaceName,data,key);this.recordExceLog(interfaceName,this.grabExceptionMessage(e),key);e.printStackTrace();}finally{this.closeAll(conn,proc);}returnrtnMsg;}
解决方案
本帖最后由 liyaming_java 于 2014-07-21 18:32:17 编辑
解决方案二:
顶一下,希望能得到高手解答