Inserting OLE Objects

  • Thread starter Mohammad Moghimi
  • Start date
M

Mohammad Moghimi

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:
--------------------------------------------------------------------------------------------------------------------
PreparedStatement st = connection.prepareStatement ("select * from
MyTable");
st.execute();
ResultSet rs = st.getResultSet();
while (rs.next()) {
int id = rs.getInt("id");
JdbcOdbcInputStream is =
(JdbcOdbcInputStream)rs.getBinaryStream("webcontent");
byte[] webcontent = is.readData();
new File("file.zip").delete();
OutputStream os = new FileOutputStream("file.zip");
os.write(webcontent);
os.close();
break;
}
 
L

Larry Linson

Mohammad Moghimi said:
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?

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

You should use the method called BLOB (Binary Large Objects) just to store
the binary file data in the OLE Object.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top