aspose file tools*
The moose likes JDBC and the fly likes unimplemented or unreasonable request at ps.execute() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "unimplemented or unreasonable request at ps.execute()" Watch "unimplemented or unreasonable request at ps.execute()" New topic
Author

unimplemented or unreasonable request at ps.execute()

Sidhu roy
Greenhorn

Joined: Aug 11, 2011
Posts: 15

i am getting error as unimplemented or unreasonable request at ps.execute(). please help me
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Also, what database are you using? Different databases support Blobs in different ways. (or not at all)
Sidhu roy
Greenhorn

Joined: Aug 11, 2011
Posts: 15
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
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

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

Joined: Aug 11, 2011
Posts: 15
thank you Paul Clapham, then what i should use??
Sudheer Bhat
Ranch Hand

Joined: Feb 22, 2011
Posts: 75
Your best bet would be to use Oracle's JDBC drivers.
Ashish Agre
Ranch Hand

Joined: Jan 22, 2011
Posts: 73

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.


| B.E IT | SCJP 6.0 98 % |
 
 
subject: unimplemented or unreasonable request at ps.execute()