且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Java / JDBC在Oracle数据库中存储长度超过4000个字符的字符串?

更新时间:2023-01-19 21:07:29

你有(至少)两个选项:

You have (at least) two options:


  • 使用 connection.createClob()来创建a Clob ,在其上设置数据,并在准备好的语句中设置它。这适用于较小的数据

  • use connection.createClob() to create a Clob, set the data on it, and set it on the prepared statement. This will work for smaller data

使用 preparedStatement.setClob(位置,读者) - 在这里你将有一个 Reader 实例。

use preparedStatement.setClob(position, reader) - here you will have a Reader instance.