Hi,
I am aware of how to store the contents to the database. What i am really interested 
is how to capture the output of the servlet. Forget PDF, assume that the Servlet is 
just serving a normal html content. After the servlet has given this to the response, 
how to capture this as a byte stream is my real question.
Thanks,
Rajesh

-----Original Message-----
From: Navjot Singh [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 7:44 PM
To: Struts Users Mailing List
Subject: RE: Storing the Output of a Servlet to Database



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:[EMAIL PROTECTED]
|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: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|
|


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to