Oracle Array populated with null data in java

When I try to throw an array of strings into an oracle stored procedure as:

String arrStr[] ={"val1","val2","val3"}; ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("STR_ARRAY", connection ); oracle.sql.ARRAY oracleArray = new oracle.sql.ARRAY(descriptor, connection, arrStr); 

oracleArray contains null data, oracleArray.datumArray = {???, ???, ???}

+2
java oracle weblogic
source share
3 answers

In my case (see my comment above), this was caused by a coding problem, however - without any exceptions or debugging information. Including orai18n.jar for library projects solved this ... it's really sad, there is no exception or something that would indicate how to solve the problem

+4
source share

After several hours I founded the reason, the real problem is the NLS_CHARACTERSET of your database with an encoding that is not supported by your client, to support jdbc, other NLS_LANG users need to add orai18n.jar to the classpath. See database settings using this sql:

SELECT * FROM NLS_DATABASE_PARAMETERS

0
source share

Your STR_ARRAY is probably defined as follows:

create or replace type STR_ARRAY is table of VARCHAR2(20);

As Thomas said, the problem is coding. My solution is to use NVARCHAR2 instead.

create or replace type STR_ARRAY is table of NVARCHAR2(20);

0
source share

All Articles