Skip to content

Commit c0747a0

Browse files
committed
JdbcUtils.getResultSetValue avoids re-retrieval from ResultSet for Blob/Clob content (for Derby compatibility)
Issue: SPR-8810
1 parent 0663282 commit c0747a0

File tree

1 file changed

+4
-2
lines changed
  • spring-jdbc/src/main/java/org/springframework/jdbc/support

1 file changed

+4
-2
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/support/JdbcUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,12 @@ public static Object getResultSetValue(ResultSet rs, int index) throws SQLExcept
239239
className = obj.getClass().getName();
240240
}
241241
if (obj instanceof Blob) {
242-
obj = rs.getBytes(index);
242+
Blob blob = (Blob) obj;
243+
obj = blob.getBytes(1, (int) blob.length());
243244
}
244245
else if (obj instanceof Clob) {
245-
obj = rs.getString(index);
246+
Clob clob = (Clob) obj;
247+
obj = clob.getSubString(1, (int) clob.length());
246248
}
247249
else if ("oracle.sql.TIMESTAMP".equals(className) || "oracle.sql.TIMESTAMPTZ".equals(className)) {
248250
obj = rs.getTimestamp(index);

0 commit comments

Comments
 (0)