@@ -255,7 +255,12 @@ public void setBlobAsBinaryStream(
255
255
256
256
if (streamAsLob ) {
257
257
if (binaryStream != null ) {
258
- ps .setBlob (paramIndex , binaryStream , contentLength );
258
+ if (contentLength >= 0 ) {
259
+ ps .setBlob (paramIndex , binaryStream , contentLength );
260
+ }
261
+ else {
262
+ ps .setBlob (paramIndex , binaryStream );
263
+ }
259
264
}
260
265
else {
261
266
ps .setBlob (paramIndex , (Blob ) null );
@@ -318,7 +323,13 @@ public void setClobAsAsciiStream(
318
323
if (streamAsLob ) {
319
324
if (asciiStream != null ) {
320
325
try {
321
- ps .setClob (paramIndex , new InputStreamReader (asciiStream , "US-ASCII" ), contentLength );
326
+ Reader reader = new InputStreamReader (asciiStream , "US-ASCII" );
327
+ if (contentLength >= 0 ) {
328
+ ps .setClob (paramIndex , reader , contentLength );
329
+ }
330
+ else {
331
+ ps .setClob (paramIndex , reader );
332
+ }
322
333
}
323
334
catch (UnsupportedEncodingException ex ) {
324
335
throw new SQLException ("US-ASCII encoding not supported: " + ex );
@@ -355,7 +366,12 @@ public void setClobAsCharacterStream(
355
366
356
367
if (streamAsLob ) {
357
368
if (characterStream != null ) {
358
- ps .setClob (paramIndex , characterStream , contentLength );
369
+ if (contentLength >= 0 ) {
370
+ ps .setClob (paramIndex , characterStream , contentLength );
371
+ }
372
+ else {
373
+ ps .setClob (paramIndex , characterStream );
374
+ }
359
375
}
360
376
else {
361
377
ps .setClob (paramIndex , (Clob ) null );
0 commit comments