This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unimplemented or unreasonable request at ps.execute()

 
Sidhu roy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i am getting error as unimplemented or unreasonable request at ps.execute(). please help me
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34195
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does s.execute("Create table Img(Image_No number(5),Photo blob)"); run successfully? I ask because you catch the exception but then continue on. If that doesn't run, all bets are off for what happens later in the program.

The actual error is about a type conversion error. I don;t usually pass the length as a second parameter to setBinaryStream. You might try without that.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34195
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, what database are you using? Different databases support Blobs in different ways. (or not at all)
 
Sidhu roy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Jeanne Boyarsky . ya i am using oracle 10g database and the table is created in the database , what you said is right. problem is with typecasting so, i tried ps.setBinaryStream(2,fis,(byte)file.length());
rather than
ps.setBinaryStream(2,fis,(int)file.length());
so, it worked properly. is it correct? can i approach in this way??
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Also, what database are you using? Different databases support Blobs in different ways. (or not at all)


The posted code uses the JDBC-ODBC bridge driver. I wouldn't be at all surprised to find out that it doesn't support blobs, even if the underlying database does.
 
Sidhu roy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Paul Clapham, then what i should use??
 
Sudheer Bhat
Ranch Hand
Posts: 75
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet would be to use Oracle's JDBC drivers.
 
Ashish Agre
Ranch Hand
Posts: 73
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well a bit off track answer from my side sorry for this... but i would rather suggest you to store the image path in the database instead of image itself.
So that either it is a web application or desktop application you only need to provide the path for the image to display. It may be Label component for desktop or img tag of the web-page.
The only thing you require to do is to save image file in some specific folder and store its path in the database and then retrieve it later to display.

Thankyou.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic