• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem retrieving Long raw data

 
Jyothsna Sri Y
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I am trying to retrive images that were stored in Oracle database in a Long raw column using Java, but I failed to do so.. can somebody please tell me what's wrong with my code??

=======================================================================
Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
}
catch(ClassNotFoundException e)
{
System.out.println("Driver Exception : " + e);
}
try
{
String url = "jdbc racle:thin:@"+ipAddress+":"+port+":"+SID;
conn = DriverManager.getConnection(url,UNAME,PASSWD);
query = "select BLOB_SEGMENT from GA_BLOB where BLOB_PERSON_ID = '"+ivjJTextField1.getText()+"'";
stmt.close();
stmt = conn.createStatement();
rset = stmt.executeQuery(query);
if(rset.next())
{
InputStream is = rset.getBinaryStream(1);
FileOutputStream fos = new FileOutputStream("candidate.jpg");
int i;
while((i=is.read())!=-1)
fos.write(i);
fos.close();
ImageIcon icon = new ImageIcon("candidate.jpg");
ivjJLabel2.setIcon(icon);
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error Collecting Image");
}

=======================================================================

What's wrong with my code??
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to post the exception and stack trace
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!