on 11-13-2008 10:45 AM
Hi,
we have to read the original message format of a message in the mapping step from the adapter database.
This original message was stored as BLOB-value there.
When we try to read the value via an accelerator object we get the following Java-Exception:
com.sap.aii.mapping.lookup.LookupException:
Plain exception:oracle.jdbc.driver.T4CConnection java.io.NotSerializableException:
oracle.jdbc.driver.T4CConnection at java.io.ObjectOutputStream.writeObject0
(ObjectOutputStream.java:1054)
Here an extraction of our source code:
...
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult rset = null;
Map rowMap = null;
try {
String sapName = GlobalProperties.getSapSystemName();
channel = LookupService.getChannel(sapName, "CC_DBLookup");
accessor = LookupService.getDataBaseAccessor(channel);
...
String sqlQuery = "select MSG_BYTES "+
"from "+oracleDB+".XI_AF_MSG "+
"where MSG_ID = '"+msgID+"'";
accessor.execute(sqlQuery);
...
When we try to read a value of another type it works fine.
Does anybody know how we can solve this problem?
Regards
Thorsten
Edited by: Thorsten Hautz on Nov 13, 2008 8:21 PM
Hi Thorsten,
It could be driver related, but Iu2019m really not sure. Perhaps someone else will have more information. I did run a quick test to see if BLOB was serilaziable. Using classes12.zip in the classpath caused the code below to fail with a similar exception to the one you showed:
java.io.NotSerializableException: oracle.sql.BLOB
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at test.BlobTeset.main(BlobTeset.java:20)
Using a newer driver (classes12_10.2.0.2.jar) and the same code works . Again, this may or may not be related, but you might at least check your driver versions.
package test;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
public class BlobTeset {
public static void main(String[] args) {
try {
// Old driver (classes12.zip) throws java.io.NotSerializableException
// New driver (classes12_10.2.0.2.jar) doesn't
oracle.sql.BLOB blob = oracle.sql.BLOB.empty_lob(); //deprecated (getEmptyBLOB)
blob.setBytes("Testing".getBytes());
// Serializeable
ByteArrayOutputStream bos = new ByteArrayOutputStream() ;
ObjectOutputStream out = new ObjectOutputStream(bos) ;
out.writeObject(blob);
out.close();
System.out.println("Done");
} catch (Exception e) {
e.printStackTrace();
}
}
}
If the driver isnu2019t the issue, and if no one else has additional information, you may need to get a connection directly from a JDBC connection pool. Check out this blog. It will help you get the connection via a data source. https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6183
From there, you should be able to find code samples for working directly with the BLOB.
-Russ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thanks for all your answers.
We have soved the problem by using a DataSource.
Regards
Thorsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Its a JDBC driver issue. Which oracle you are using is it 9i? Update the driver with PI to sort this
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.