Home » Open Source » Programming Interfaces » My java object comes plsql as null (oracle 11g java 1.5)
My java object comes plsql as null [message #362925] Thu, 04 December 2008 09:21
futi
Messages: 22
Registered: November 2007
Junior Member
hi, i am trying to send my java object to oracle. I set lots of settings to perform this.

1-) I've created a oracle sql type as object.
2-) Then i've created a java class that implements SQLData interface to send its fields to Oracle.
2-1) Override readSql and writeSql functions.
3-) After i've got Connection object, i am creating a Dictionary Map, to match my java object to oracle.

I performed these settings, and when i run my application, my java objects seem that passed from java to Oracle correctly. There was any error. In plsql, procedure insert fields of my sql object ( that matches java object ) to a table. But table rows look null. What is the problem? I could not recognize that there is an error.

My Callable Statement : public static final String stream_sql = "{ call AQ_ADM_PRTP.AQ_PRTP.ENQUEUE_STREAM_TYPE(?,?,?,?) }";
Oracle Type is defined in java as : public static final String oracle_stream_type = "AQ_ADM_PRTP.STREAM_TYPE";

My map settings are specified as below :
Dictionary myMap = (Dictionary)conn.getTypeMap();
myMap.put("AQ_ADM_PRTP.STREAM_TYPE", Class.forName("nor.StreamType"));

in loop i am sending java object to oracle as follows:

StreamType st = new StreamType(Global.oracle_stream_type);
st.SCCPContextId = "aa";
st.activationCellCgi_ci = "aa";
st.callNumber = "aa";
st.dataType = "aa";
st.imei_lac = "aa";
st.imei_tac = "aa";
st.imsi_mcc = "aa";
st.imsi_mnc = "aa";
st.imsi_rec = "aa";
st.originationCellCgi_ci = "aa";
st.targetCellCgi_ci = "aa";
st.terminationCellCgi_ci = "aa";

cstmt.setObject(1, st);
cstmt.setInt(2,1);
cstmt.setString(3, "");
cstmt.setString(4, "");

cstmt.addBatch();

if ( satir == 100 )
{
cstmt.executeBatch();
conn.commit();
satir = 0;
System.out.println("> Streamden aldigim batchi bastim.");
}
When i run this code, everything seems fine but i see that values are gone to plsql as null when i look at database table.

How can i fix this problem?

Thanks,
Fuat.
Previous Topic: Problem with ODT for .NET
Next Topic: linking oracle 9idb to ms access
Goto Forum:
  


Current Time: Thu Mar 28 03:46:04 CDT 2024