Hi all, I am able to insert the blob column in the database. Now, I want to check whether the element is inserted or not and so I am trying to retreive the bolb through JDBC. But it is giving me the error. I tried to check it out in as many ways as possible by me. Can someone look into it and reply back. I will greatly appreciate that. Thanks,Statement sment=conn.createStatement(); ResultSet rs = sment.executeQuery(sql); String returndata=null; txtfield.append("HI"); if (rs.next()) { System.out.println("In the if loop"); try { System.out.println("in the try loop"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.out.println("qqqqqqqq"); BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream("XYCOORD")); System.out.println("aaaaaaaaaaaa"); byte[] bindata=new byte[1024]; System.out.println("aaaaaaaaaaaa"); int bytesread = 0; System.out.println("In the try loop"); if ((bytesread = bis.read(bindata,0,bindata.length)) != -1) { baos.write(bindata,0,bytesread); } else { returndata=baos.toString(); } System.out.println("Before the try loop"); txtfield.append("HI"); // txtfield.append(rs.getString("DRAW_ID")); // txtfield.append(rs.getString("I_ID")); // txtfield.append(returndata); // txtfield.append(rs.getString("MA_DESC")); System.out.println("Query executed"); // bis.close(); } catch (IOException ioe) { System.err.println("Problem retreiving binary data : " + ioe); } catch (Exception cnfe) { System.err.println("Problem retreiving binary data : " + cnfe); } } rs.close(); this is my code where i want to retreive the blob. XYCOORD is the blob column in the database. It is very urgent as I need to submit my project as the deadline is appraoching for me(I am a student) Bharat.
Bharat Agarwal
Greenhorn
Joined: Jun 16, 2001
Posts: 21
posted
0
here is the error that it is giving meIn the if loop in the try loop qqqqqqqq java.lang.NoClassDefFoundError: oracle/sql/BLOB at oracle.jdbc.driver.OracleStatement.getBinaryStreamValue(OracleStatement.java:3626) at oracle.jdbc.driver.OracleResultSetImpl.getBinaryStream(OracleResultSetImpl.java:375) at oracle.jdbc.driver.OracleResultSet.getBinaryStream(OracleResultSet.java:1488) at TestProject.action(TestProject.java:309) at java.awt.Component.handleEvent(Component.java:570) at java.awt.Component.postEvent(Component.java:935) at java.awt.Button.process(Button.java:205) at java.awt.ActionEvt.dispatch(ActionEvt.java:16) at java.awt.EventDispatchThread.run(EventDispatchThread.java:39)
I could not understand y it is not going ahead of the BufferedInputStream method....
Thanx in advance.
srikanth bukkapatnam
Greenhorn
Joined: Jul 31, 2001
Posts: 7
posted
0
Do you have classes12.zip in your classpath?. Sometimes the drives also makes difference, are you using thin client or oci?
Chad McGowan
Ranch Hand
Joined: May 10, 2001
Posts: 265
posted
0
Have you tried byte[] bytes = null . . Blob b = rs.getBlob("XYCOORD"); bytes = b.getBytes(1,b.length); This works for me. You could also use b.getBinaryStream() to return an InputStream. Chad
[This message has been edited by Chad McGowan (edited August 09, 2001).]