Bookmark Topic Watch Topic
  • New Topic

store the image in oracle  RSS feed

 
shahul hameed
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

When i try to store the image, iam getting one exception like
java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested. In the table, i declared the image field as BLOB data type.
Herewith i have attached my code snippet. just go through this code and say me what is the problem. Iam working in windows - oracle client. but the oracle server in linux. Admin has set the NLS_LANG also. He set the NLS_LANG like AMERICAN_AMERICA.ALUTF8 -something. Database admin is telling that some content is missing in database. I dont know what the content is missing. What i need to check. i raised this question before, they informed, the problem is in database conversion. Could you help me please.


String filename = "d:/commercial.gif";
if (!filename.equals("")) {
PreparedStatement ps = con.prepareStatement("insert into picture (id,picture1) values (?,?)");
ps.setString(1, "imageId");
FileInputStream fis = new FileInputStream(filename);
ps.setBinaryStream(2, fis, fis.available());
ps.execute();
ps.close();
} else {
PreparedStatement ps = con.prepareStatement("insert into picture (id,picture1) values (?, empty_blob())");
ps.setString(1, "imageId");
ps.execute();
ps.close();
}



thanks
 
Joe Ess
Bartender
Posts: 9426
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question more than once. It causes confusion and duplication of effort as the community tries to help everyone.
Have a look at our FAQ, HowToAskQuestionsOnJavaRanch
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!