I have a string in java, but the datatype in database is Clob. How do i get a Clob fro开发者_JS百科m String?
clob.setString(position, string)
writes a String to a Clob object.
new javax.sql.rowset.serial.SerialClob(source.toCharArray())
To Convert any String(small strings or big JSON converted to strings) in to CLOB we need to initialize CLOB first:
CLOB clob = (CLOB) con.createClob();
clob.setString(position, "Any String Here");
Where con
is Connection
精彩评论