开发者

String to Clob in Java?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜