• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

unimplemented or unreasonable request at ps.execute()

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i am getting error as unimplemented or unreasonable request at ps.execute(). please help me
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Sheriff
Posts: 28324
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you Paul Clapham, then what i should use??
 
Ranch Hand
Posts: 75
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your best bet would be to use Oracle's JDBC drivers.
 
Ranch Hand
Posts: 73
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You get good luck from rubbing the belly of a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic