java.sql.SQLException: ORA-03115: unsupported network datatype or representation

java.sql.SQLException: ORA-03115: unsupported network datatype or representation

I was getting the above exception when I was trying to set a CLOB data in the database using java.

More understanding about this exception can be get from

http://www.coderanch.com/t/302117/JDBC/java/java-sql-SQLException-ORA-unsupported

The mistake I was doing and getting the same exception was
While preparing the PreparedStatement Object, i was passing the query like this

pstmt = conn.prepareStatement(sqlQuery.toString());  

And while executing it, again I was giving the query in the overloaded method.

// Please note that DO NOT USE pstmt.executeUpdate(String) overloaded method   
// That will give you this exception :
// java.sql.SQLException: ORA-03115: unsupported network datatype or representation
int rowsUpdated = pstmt.executeUpdate();

Use the executeUpdate method without arguments and not the one with a String argument

After making this change, I didn’t get this exception.

Exact root cause is still unknown to me as well.

If someone understands it better, please explain it to me as well.

Also to set the clob data in the database you can use the following

String xml= getXml();   
InputStream is = new ByteArrayInputStream(xml.getBytes());
pstmt.setAsciiStream(++psCount, is, xml.length());

About Vineet Verma

Developer/Blogger/Gamer/Lazy Couch Potato...:P Need PDF Books: Knowledge Base
This entry was posted in JDBC, Oracle. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s