• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Storing large image files

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting problem when I try to store large image files
into blob column. I am getting ORA-01461: can bind a LONG value only for insert into a LONG column when I tried to insert
large image files. It works fine for small image files. The code
is as follows;
PreparedStatement stmnt = conn.prepareStatement(
"insert into tempfile (name,file_blob) values (?,?)");

stmnt.setString(1,"temp");
stmnt.setBinaryStream(2, new FileInputStream(file), (int) file.length());
stmnt.execute();
stmnt.close();
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sri, I am not quite sure how big your image files are.
My experience is to save the image names in Oracle and the actual image files separately. Although you can save image files in Oracle DB, you can have problem when an image file is too large.
Frank W.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to store large images based on
the Advanced JDBC samples from Oracle Technology Network.
These samples use oracle.sql and oracle.jdbc.driver packages.
I coudnt get the sample from the javasoft site to work with
large images. It works with very small images. I dont know why since no exceptions are getting thrown.
URLs:
Sample for Oracle Tech net: http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/sample_code_index.htm
Sample from Javasoft: http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/BLOBGet/index.html)
reply
    Bookmark Topic Watch Topic
  • New Topic