Losing newline characters when saving Java string to Oracle CLOB field
By : user2930472
Date : March 29 2020, 07:55 AM
|
How to update Oracle Clob by using JDBC
By : illusiveman1908
Date : March 29 2020, 07:55 AM
it helps some times Not sure why you call that the "normal" way, but the following works for me. It doesn't require any retrieval of the data before updating it. code :
String value = "So long and thanks for all the fish";
StringReader reader = new StringReader(value);
pStmt = conn.prepareStatement("UPDATE PROGRAM_HISTORY SET DETAILS = ? WHERE ID = 12");
pStmt.setCharacterStream(1, reader, value.length());
pStmt.executeUpdate();
|
java.lang.ClassCastException: oracle.sql.CLOB cannot be cast to oracle.sql.CLOB
By : S.Mule
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I fixed the problem. Posting this answer, hoping it might be useful to someone. When I was checking the instance type of the CLOB retrieved by the query, it came up as oracle.sql.CLOB. So I assumed it must have been a version mismatch of ojdbc.jar. I checked my project a gazillion times for multiple copies of the ojdb.jar. There were none.
|
JDBC Stream of CLOB in Oracle 12.2 database gives wrong encoding
By : user1502455
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further We identified the problem and found a solution (which is more of a workaround perhaps). Under Oracle 12.1 the property oracle.jdbc.defaultLobPrefetchSize was set to -1 by default. Under Oracle 12.2 this changed to 4000, which means that the database will try to fetch everything within one query and cast the CLOB to a VARCHAR2 (if its size is under 4000, See here). This somehow doesn't work with Oracle 12.2 while the Charset WE8ISO8859P15 is used.
|
NotSerializableException while getting CLOB data from ORACLE using JDBC
By : user4954850
Date : March 29 2020, 07:55 AM
may help you . Don't try to serialize a CLOB. Transform it to a String. A CLOB is an object that is connected to the database and allows reading data from it while the connection is open. Serializing it makes no sense, just as serializing a Socket makes no sense.
|