2 Replies Latest reply on Feb 1, 2020 1:00 PM by RN

    java.sql.Struct: unable to populate object type


      Hi all,

      I am seeking some help based on some limited knowledge. Please look at the below piece of code:


      public oracle.sql.STRUCT createSessionInfoObj(Connection conn, JSONObject req) throws Exception  {


              String attrs[] = new String[SESSION_ATTR_NUM];

              for (int i=0; i<2; i++) {   

                  attrs[i] = req.getStr(SESSION_ATTR_NAMES[i]);

                  System.out.println(SESSION_ATTR_NAMES[i] + ": " + attrs[i]);


      At this point, attrs array has the data and it prints absolutely fine.

              oracle.sql.StructDescriptor structDesc =

              oracle.sql.StructDescriptor.createDescriptor(SESSION_INFO_OBJ, conn);            

              oracle.sql.STRUCT sessionInfoObj = new oracle.sql.STRUCT(structDesc, conn, attrs);

              System.out.println("sessionInfoObj: " + sessionInfoObj.dump() );

              return sessionInfoObj;


      Here when sessionInfoObj  is pouplated with attrs array and we print out the data of sessionInfoObj  but it is empty.

      SESSION_INFO_OBJ is a Type defined in the database as below:

      create or replace TYPE  SESSION_INFO_OBJ AS OBJECT


      session_key VARCHAR2(80),

      ip_address  VARCHAR2(50)


      The application code has the necessary privileges to access this object.  I believe(but could be wrong) it is not a permission issue because when Java tries to print sessionInfoObj, it prints two components of the object (as defined in the database type), but they are blank.. see below:

      SESSION_KEY = ???

      IP_ADDRESS = ???


      What could be the problem? We have this working in several environments. We are trying to deploy the application on a brand new environment and it's not working there.

      Oracle database: 18c

      Using ojdbc6

      JDK version 11.05

      Using Tomcat

      The application is deployed on a docker container.

      Please let me know if some other details are needed and I can get them from my team.

      PS: I am not sure if I chose the correct space to post this thread. Please advise.