Home » Infrastructure » Windows » how to retrieve the blob column data from table? (oracle 10g,xp)
icon14.gif  how to retrieve the blob column data from table? [message #497815] Mon, 07 March 2011 06:11 Go to next message
shankar123
Messages: 3
Registered: March 2011
Location: INDIA
Junior Member
I use the oracle 10g database.I am trying to insert and retrive the image.Inserting an image is done.but while retrieving an image iam getting an run time exception in java "java.sql.sqlexception:general error".i am not able to understand this.
The code to insert the image is
FileInputStream fi=new FileInputStream(f);
int size = fi.available();
System.out.println("j"+size);
byte b1[] = new byte[size];
i=fi.read(b1,0,size);
System.out.println("i"+i);
st.executeUpdate("insert into image1 values('b1',"+k+")");
when i am retrieving the image i tried like this
ResultSet rs=st.executeQuery("select imagecolumn from tablename");
here iam getting an exception as i named above.
Re: how to retrieve the blob column data from table? [message #497826 is a reply to message #497815] Mon, 07 March 2011 06:55 Go to previous messageGo to next message
Michel Cadot
Messages: 68633
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Copy and paste the error code and error you get.

Before, Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel
Re: how to retrieve the blob column data from table? [message #497828 is a reply to message #497815] Mon, 07 March 2011 06:57 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
st.executeUpdate("insert into image1 values('b1',"+k+")");


What is this "k" you insert here? You should be inserting with a bind variable you set with setBlob
Re: how to retrieve the blob column data from table? [message #498204 is a reply to message #497828] Wed, 09 March 2011 04:20 Go to previous messageGo to next message
shankar123
Messages: 3
Registered: March 2011
Location: INDIA
Junior Member
the exception that i got at resultset is
java.sql.sqlexception:general error
Re: how to retrieve the blob column data from table? [message #498208 is a reply to message #497828] Wed, 09 March 2011 04:22 Go to previous message
shankar123
Messages: 3
Registered: March 2011
Location: INDIA
Junior Member
you dont bother about the k variable.I can take care of that.
please tell me about the problem i have at resultset. I am getting exception there?
Previous Topic: Connecting Oracle to Remote Access Server
Next Topic: rename command in dos
Goto Forum:
  


Current Time: Mon Apr 15 23:58:41 CDT 2024