aspose file tools*
The moose likes BEA/Weblogic and the fly likes Weblogic temporary clob not getting written to or not reflecting text written to it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Weblogic temporary clob not getting written to or not reflecting text written to it." Watch "Weblogic temporary clob not getting written to or not reflecting text written to it." New topic
Author

Weblogic temporary clob not getting written to or not reflecting text written to it.

Bruce Sanders
Greenhorn

Joined: Jan 03, 2012
Posts: 6

I've posted this on Oracle's web site but I thought I would already try here:

Problem: Unable to write to an empty clob

Weblogic version 8.1, SP unknown

Oracle JDBC version - 1.4

Current code to create CLOB:
Statement s = c.createStatement();
return CLOB.createTemporary(
((weblogic.jdbc.extensions.WLConnection)s.getConnection()).getVendorConnection(),true, CLOB.DURATION_SESSION);
OR
((weblogic.jdbc.extensions.WLConnection)s.getConnection()).getVendorConnection(),true, CLOB.MODE_READWRITE);

Data trying to write to CLOB:
MERGE INTO APPEAL_FINAL_STATUS TGT
USING (SELECT STATUS.APPEAL_FINAL_STATUS_SK
FROM APPEAL_FINAL APPEAL,
APPEAL_FINAL_STATUS STATUS
WHERE APPEAL.DECISION_BATCH_SK = :V_DECISION_BATCH_SK
AND STATUS.APPEAL_ID = APPEAL.APPEAL_ID
AND STATUS.DECISION_BATCH_SK = APPEAL.DECISION_BATCH_SK
AND STATUS.APPEAL_STATUS = 'IN REVIEW' AND
AND APPEAL.DUPLICATE_APPEAL_ID IS NOT NULL) SRC
ON (TGT.APPEAL_FINAL_STATUS_SK = SRC.APPEAL_FINAL_STATUS_SK)
WHEN MATCHED THEN UPDATE
SET TGT.APPEAL_STATUS = 'CLOSED DENIED'

Clob value before attempting to write: &    K?3  .
 ??????



Code resulting in Result 1:
Writer writer = clob.setCharacterStream(0L);
writer.write(String.valueOf(sqlText).toCharArray());
writer.flush();
writer.close();

Result 1: Clob value from code that I run using JBOSS that works but doesn't work in Weblogic as you can see: &    K?3  .
 ??????


Code resulting in Result 2:
char[] ch = new char[sqlText.length()];
System.out.println("char length - " + ch.length);

int ii = clob.putChars(1, ch);

Result 2:
char length - 619
clob value: &    K?3  .
 ??????
clob from putchars items written - 619(this is the value of ii from the clob.putChars(1, ch) from result 2 above.

Code resulting in Result 3:
StringReader sr = new StringReader(sqlText);
char[] bufr = new char[clob.getChunkSize()];
int charsRead = 0;

OutputStream os = clob.getAsciiOutputStream();

for(charsRead = sr.read(bufr); charsRead>-1; charsRead = sr.read(bufr)){
os.write(charsRead);
}

os.flush();
os.close();
sr.close();

Result 3:
clob value: &    K?3  .
 ??????

Code used to display clob:
Byte[] zz = clob.getBytes();
String xx = new String(zz);
System.out.println("clob value - " + xx);











 
Don't get me started about those stupid light bulbs.
 
subject: Weblogic temporary clob not getting written to or not reflecting text written to it.