Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Italy
    Posts
    5

    Unanswered: problems with blob and jdbc

    hello,
    I'm trying to save files on a blob column...
    all works with method

    PreparedStatement.setBinaryStream(in column,InputStream,int length);

    but the probem is that ant integer is too short to upload large files.....
    what may I do?


    I tried in another way:

    Blob b=rs.getBlob("picture");
    **OutputStream o=b.setBinaryStream(0);**
    i=0;
    while ((i=fin.read())!=0)
    o.write(i);

    PreparedStatement pstmt=con.prepareStatement("update emp_photo set picture=? where empno='000130'");
    pstmt.setBlob(1,b);

    pstmt.execute();
    but ** line throws an AbstractMethodException.....

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: problems with blob and jdbc

    Originally posted by zioluter
    hello,
    I'm trying to save files on a blob column...
    all works with method

    PreparedStatement.setBinaryStream(in column,InputStream,int length);

    but the probem is that ant integer is too short to upload large files.....
    what may I do?


    I tried in another way:

    Blob b=rs.getBlob("picture");
    **OutputStream o=b.setBinaryStream(0);**
    i=0;
    while ((i=fin.read())!=0)
    o.write(i);

    PreparedStatement pstmt=con.prepareStatement("update emp_photo set picture=? where empno='000130'");
    pstmt.setBlob(1,b);

    pstmt.execute();
    but ** line throws an AbstractMethodException.....
    DB2 does not support BLOBs larger than 2 GB anyway, so int should be sufficient (max. Java int value is 2147483647)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •