Re: ORACLE与JAVA问题求助达人

论坛:IT江湖作者:绿豆包子发表时间:2004-06-15 22:07
有JIVE的源代码吗?
看一下ConnectionManager.java 里面有一个setLargeTextField 方法。

/**
* Sets a large text column in a result set, automatically performing
* streaming if the JDBC driver requires it. This is necessary because
* different JDBC drivers have different capabilities and methods for
* setting large text values.
*
* @param pstmt the PreparedStatement to set the text field in.
* @param parameterIndex the index corresponding to the text field.
* @param value the String to set.
*/
public static void setLargeTextField(PreparedStatement pstmt,
int parameterIndex, String value) throws SQLException
{
if (streamLargeText) {
Reader bodyReader = null;
try {
bodyReader = new StringReader(value);
pstmt.setCharacterStream(parameterIndex, bodyReader, value.length());
}
catch (Exception e) {
e.printStackTrace();
throw new SQLException("Failed to set text field.");
}
// Leave bodyReader open so that the db can read from it. It *should*
// be garbage collected after it's done without needing to call close.
}
else {
pstmt.setString(parameterIndex, value);
}
}
标签: 添加标签

0 / 0

发表回复
 
  • 标题
  • 作者
  • 时间
  • 长度
  • 点击
  • 评价

京ICP备14028770号-1