File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Getting java.sql.SqlException Data size bigger than max size for this type: 275091 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting java.sql.SqlException Data size bigger than max size for this type: 275091" Watch "Getting java.sql.SqlException Data size bigger than max size for this type: 275091" New topic
Author

Getting java.sql.SqlException Data size bigger than max size for this type: 275091

Aniket V Kulkarni
Greenhorn

Joined: Apr 30, 2013
Posts: 5

Hi All,

I am working on struts 1.x application. In that I am trying to upload file as blob in oracle database. I dont want to update the oracle table directely, I need to pass the file as a blob to oracle stored procedure as IN parameter.
I did the follwong things.

FormFile uploadFile = (FormFile)uploadForm.get("uFile");
InputStream inputFile = uploadFile.getInputStream();
String fileName = uploadFile.getFileName();
..
CallableStatement stmt = conn.prepareCall("{call UPLOAD_FILE(?,?,?)}");
stmt.setBinaryStream(1, inputFile, inputFile.available());
stmt.setString(2,fileName);
stmt.registerOutParameter(3, Types.VARCHAR);

I am using CallableStatement's setBinaryInputStream() and is working fine for max file size 31kb, but my file size would be around 300kb. When I tried with file size 300kb its giving following exception:
java.sql.SQLException Data size bigger than max size for this type: 275091

I tried with CallableStatement's setBlob() but its not working, its giving java.lang.AbstractMethodError exception.
At some forum I found that this is the problem with JDBC driver version 10.1.0.5.0 but my JDBC driver version is 11.2.0.3.0 still getting the same exception.

Please help me to solve this.

Thanks,
Aniket



Carles Gasques
Ranch Hand

Joined: Apr 19, 2013
Posts: 199
    
    1
Hi,

Could be a limit in the stored procedure (pl/sql side) for the variable ┬┐datype RAW? that holds the inputstream (first param)?

Best regards,
Aniket V Kulkarni
Greenhorn

Joined: Apr 30, 2013
Posts: 5

Hi Carles Gasques

Thanks for your reply.

Actually at oracle side stored procedures IN parameter is of BLOB type.
following is the oracle stored procedure.

PROCEDURE upload_contract (
p_blob IN BLOB,
p_naam IN VARCHAR2,
p_status OUT VARCHAR2
)
IS
l_blob BLOB;
l_naam VARCHAR2 (4000);
BEGIN
l_blob := p_blob;
l_naam := p_naam;

INSERT INTO sy_blob_test VALUES (l_blob,l_naam);
COMMIT;
p_status := 'OK';
END upload_contract;

This stored procedure is written just for testing whether BLOB gets populated in the test table or not. File with size upto 31kb get populated in SY_BLOB_TEST table. If file size goes above that(31kb) then it gives that exception. Dont know whether its a limitation of oracle BLOB or jdbc driver not able to hold bigger file data.

-Aniket
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting java.sql.SqlException Data size bigger than max size for this type: 275091