By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,755 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

Long Binary Data v OLE Object

P: 3
Dear all,

I want to store some data in form of a zip file into an access
database.
I created a table with with a column of type OLE Object, then I
designed a form to insert data to the table.
I inserted some files to it, but when I tried to read them using my
java client it retrieves an OLE object but I just need the file
content (what the program gets form the db was the original file added
with some extra binary information at the beginning and the end of the
file)

I wrote a program for inserting and retrieving a file in java, and it
works perfect, but when I insert a file using the access form I cannot
read it using my java client.

The additional information which may helps is that when I insert a
file using ms access form in the table, it is shown as 'Package' in
the table data sheet and when I insert it using java that is 'Long
binary data'.

How can I design a ms access form to insert files in long binary data
format?

Here is my code fragment which read the database:
--------------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. PreparedStatement st = connection.prepareStatement ("select * from
  2. MyTable");
  3. st.execute();
  4. ResultSet rs = st.getResultSet();
  5. while (rs.next()) {
  6.  int id = rs.getInt("id");
  7.  JdbcOdbcInputStream is =
  8. (JdbcOdbcInputStream)rs.getBinaryStream("webcontent");
  9.  byte[] webcontent = is.readData();
  10.  new File("file.zip").delete();
  11.  OutputStream os = new FileOutputStream("file.zip");
  12.  os.write(webcontent);
  13.  os.close();
  14.  break;
  15. }
--------------------------------------------------------------------------------------------------------------------

Thanks in advance,
--

Mohammad Moghimi
May 2 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.