Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieving OLE object from database to web

 
orelia hans
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I am storing some files in my Access database as OLE object. Now I want to be able to retrieve them by pressing a link on my jsp page but I am having troubles wit my code. I am not sure how to retrieve an OLE object. If you have any idea, please help.
My codeto retrieve the file:
public String execute5(String st, Writer out)
{
String et = "unknown";
try
{String sql = "SELECT * FROM Publications WHERE PublicationTypeID = '" +st+"'";
Connection con = DriverManager.getConnection("jdbc dbc:AcessCore");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
while (rs.next())
{
//read data from database
String publicationNum=rs.getString(1);
Object document=rs.GetObject(11,"OleObject");
et = publicationNum;}
rs.close();
s.close();
con.close();
}
catch (SQLException sqle)
{
sqle.printStackTrace();
}
catch(IOException eio)
{
}
return et;
}

I am having this error:
C:\Tomcat\Tomcat\webapps\CoreData\WEB-INF\classes\Helper\CoreDataDetails.java:187: cannot resolve symbol
symbol : method GetObject (int,java.lang.String)
location: interface java.sql.ResultSet
Object document=rs.GetObject(11,"OleObject");
^
1 error
Tool completed with exit code 1
I think this is not the proper way to do this.
Thanks for your help
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume OLE is storing the file as a binary object? If not, look into Blobs and Clobs (this works with Oracle, not sure about MS stuff).
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is more of a JDBC than a JSP question, moving to the JDBC forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic