如何在JPD中的PreparedStatement中使用setClob() [英] How to use setClob() in PreparedStatement inJDBC
本文介绍了如何在JPD中的PreparedStatement中使用setClob()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是信息:
- 我有一个字符串
- 我想插入一个在
数据类型为CLOB
的列中的String中记录。 - 我想使用
setClob()
preparedstatement的方法。
- I have a String
- I want to insert a record in a table with the String in a column whose
datatype is
CLOB
. - I would like to use
setClob()
method of the preparedstatement.
所以我的问题是如何创建一个 Clob
来自此String的对象,以便I
可以使用 setClob()
方法。
So my question is how to create a Clob
object from this String so that I
can use setClob()
method.
提前致谢,
Naveen
Thanks in advance, Naveen
推荐答案
如果你想写一个字符串到CLOB列只需使用 PreparedStatement.setString
。
If you want to write a String to CLOB column just use PreparedStatement.setString
.
如果您想知道如何从String创建CLOB这是它
If you want to know how to create a CLOB from String this is it
Clob clob = connection.createClob();
clob.setString(1, str);
这篇关于如何在JPD中的PreparedStatement中使用setClob()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文