我正在尝试将 String 转换为 Clob 以存储在数据库中。我有以下代码:
Clob clob = connection.createClob();
System.out.println("clob before setting: " + clob);
clob.setString(1,"Test string" );
System.out.println("clob after setting: " + clob);
System.out.println("clob back to string: " + clob.toString());
当我运行它时,没有设置 Clob,输出如下:
clob before setting: org.apache.derby.impl.jdbc.EmbedClob@1f5483e
clob after setting: org.apache.derby.impl.jdbc.EmbedClob@1f5483e
clob back to string: org.apache.derby.impl.jdbc.EmbedClob@1f5483e
我到处都说要使用 setString 方法,我不知道为什么这对我不起作用。