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;
}
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;
}