Hi all,
Does anyone know how to read the contents a database blob is pointing to
using java?
I've tried various methods (code is below) but can't get to the actual data.
Basically,
we store allowed MIME types in a BLOB in our database. I want to be able to
display and manipulate
the MIME types as an array or vector (not particular as long as I can see
and evaluate the contents).
However, I've only been able to display the address or a series of integers
using what I could get from
the JDK 1.3.1 online document pages under Resultset and BLOB.
Can someone please point me in the right direction?
Thanks in advance,
Margaret
while (rs.next()){
blob = rs.getBlob(2);
long len = blob.length();
byte [] data = blob.getBytes((long)1,
(int)len);
for (int q = 0; i < len; i++) {
byte b = data[i];
System.out.println(b);
}
/*
java.io.InputStream in =
blob.getBinaryStream();
byte b;
while ((in.read()) > -1) {
b = in.read();
System.out.println(b);
}
BufferedInputStream bis = new BufferedInputStream(
new ByteArrayInputStream (blob.getBytes((long)
1, (int)blob.length())));
System.out.println(bis);
String mime=null;
for(k=0;k<bis.available();k++)
{int b=bis.read();
mime=mime+Integer.toString(b);
}
// GZIPInputStream gzis = new
GZIPInputStream(bis);
// System.out.println(gzis);
// ObjectInputStream ois = new
ObjectInputStream(gzis);
// System.out.println(ois);
// Object mime = ois.readObject();
System.out.println(mime);
mimetypes[i]=mime;
System.out.println(mimetypes[i]);
// ois.close();
*/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html