Class exception to exception from oracle.jdbc.driver.OracleConnection

I get an exception in the first line below the code

java.lang.ClassCastException: oracle.jdbc.internal.OracleConnection $$ EnhancerByProxool $$ 3415e85 cannot be passed to oracle.jdbc.driver.OracleConnection

How to convert string to oracle.sql.Clob and how to paste using PreparedStatement .

 // con is java.sql.Connection object oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(con, false, oracle.sql.CLOB.DURATION_SESSION); newClob.putString(1,transcript); pstmt.setClob(1, newClob); pstmt.setString(2, StringUtils.dateToMillis(endTime)); pstmt.setString(3, sessionID); int count = pstmt.executeUpdate(); System.out.println("updated count ::"+count); System.out.println("transcript updated...."); 
+4
source share
1 answer
 Clob clob = connection.createClob(); clob.setString(1, transcript); 

Or just use the setClob () method to read as an argument:

 pstmt.setClob(1, new StringReader(transcript)); 

No need to use any database class. JDBC is assumed to be an abstraction layer of agnostic database.

+2
source

Source: https://habr.com/ru/post/1413301/


All Articles