struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Navjot Singh" <navjo...@net4india.net>
Subject RE: Storing the Output of a Servlet to Database
Date Tue, 03 Jun 2003 14:14:13 GMT

Ideally, you should store the document on file system, the better place for
PDF BUT you may some weird requirement
Anyway, if you are adamant on doing this.

--first way--

0. create a field in your database with blob data type. (I have MySQL) but
oracle/ mssql7 all have this data type.
1. generated pdf document needs to converted into binary data. ( it is be
default ;-)
2. write it down to that field as normal query.

you may wish to see java.sql.Blob and java.sql.prepraedStatement.setBlob

--second way--
0. create a field in your database with varbinary type.
1. generated pdf document. read it as byte stream and get arrys of bytes.
2. write it down to that field as normal query.

see java.sql.prepraedStatement.setBytes

HTH
navjot



|-----Original Message-----
|From: Rajesh P [mailto:rajesh.p@mphasis.com]
|Sent: Tuesday, June 03, 2003 5:28 PM
|To: Struts Users Mailing List
|Subject: Storing the Output of a Servlet to Database
|
|
|Hello Everyone,
|I have a requirement wherein a Servlet class is used to generate a
|PDF document. This output should be stored into a database table
|for future retrieval. Can somebody tell me how this output of the
|Servlet can be captured and stored into a database table? Or
|rather, how to capture the response outputstream, convert it to
|bytes so that it can be persisted in the datbase. Please note that
|we are not allowed to write to a File and then upload it.
|Thanks,
|Rajesh
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
|For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message