Home » Developer & Programmer » JDeveloper, Java & XML » Oracle User Defined Types and JDBC
Oracle User Defined Types and JDBC [message #91725] Tue, 21 January 2003 12:26 Go to next message
CK
Messages: 20
Registered: February 2001
Junior Member
I created a user defined object in oracle called APPLICATION that contains a static method procedure called POPULATE that contains 3 parameters. The static procedure POPULATE basically populates the APPLICATION object.

CREATE OR REPLACE
Type TEST.APPLICATION
AS OBJECT
(
APP_ID NUMBER(10),
APP_NAME VARCHAR2(50),
APP_MNE VARCHAR2(50),
APP_DESC VARCHAR2(255),
APP_LOB VARCHAR2(50),
APP_MGR VARCHAR2(50),
APP_HRDWR INTARRAY,

STATIC PROCEDURE populate
( param1 IN NUMBER,
param2 OUT APPLICATION,
param3 OUT VARCHAR2)

)

I have a java client that calls the static method POPULATE and then tries to evaluate the Objects attributes, unfortunately the attributes are reflected in hex and not the intended type i.e. String.

Java Code:
***************************

conn = (OracleConnection)
DriverManager.getConnection("jdbc:oracle:oci8:@test",
"test", "test");
ocs = (OracleCallableStatement)conn.prepareCall("{call APPLICATION.POPULATE(?,?,?) }");
ocs.setInt(1, 2);
ocs.registerOutParameter(2, OracleTypes.STRUCT, "APPLICATION");
ocs.registerOutParameter(3, OracleTypes.VARCHAR);

ocs.execute();
application app = (application)ocs.getCustomDatum(2, application.getFactory());

System.out.println("Application Desc is -> " + app.getAppDesc());
System.out.println("Application Mgr is -> " + app.getAppMgr());

ocs.close();
conn.close();

****************************

The output is:

Application Desc is -> 0x417070204465736372697074696F6E
Application Mgr is -> 0x74

Which when translated are the correct values used in the objects constructor in the POPULATE method. Does anyone have any idea as to why this is occurring?

BTW..I am using Oracle JDBC driver 8.17
Re: Oracle User Defined Types and JDBC [message #91726 is a reply to message #91725] Tue, 21 January 2003 12:53 Go to previous message
CK
Messages: 20
Registered: February 2001
Junior Member
I got this corrected by adding Oracles NLS package to my classpath.
Previous Topic: Extraction of xml takes long time
Next Topic: Re: How can i load Java
Goto Forum:
  


Current Time: Thu Mar 28 06:42:23 CDT 2024