Re: PDF from FOP to database as BLOB

2002-05-16 Thread Lee Goddard
At 10:51 16/05/2002 -0500, [EMAIL PROTECTED] wrote:
... Since our users can wait for these
reports we've decided to run a nightly job to create them and store the
PDFs in our database as a BLOB.  That way during peak usage hours our
servers will only need to deal with returning the PDF to the browser.
...My question is, HOW, using FOP and JDBC can I get my PDF into the 
database as a BLOB.

Any Ideas would be very helpful.
I worked on a project like that. One big question:
what is wrong with a file system?  In other words, why
tax a database with such a heavy load, when you can
use the Apache HTTPD. Just write a little Perl to convert
the docs as they come in, and put them in an obvious place,
and add them to an index page in good old HTML.  Or, if
you really wanna use that DB, index their URI and attributes.
Or is there a good reason why not? (Like, you work for Oracle...)
Lee
Lee Goddard
perl -e while(1){print rand0.5?chr 47:chr 92}


AW: PDF from FOP to database as BLOB

2002-05-16 Thread Chaumette, Patrick
Hello Shawn,

you can make FOP write to an ByteArrayOutputStream.
By doing something like this:

ByteArrayOutputStream os = new ByteArrayOutputStream();

...(driver+FOP stuff)...

driver.setOutputStream(os);

InputStream is = new ByteArrayInputStream(os.getBytes());

.. now read from stream...

Hope this helps,
greetings,
Patrick


Dipl. Inform. Patrick Chaumette

T-Systems ITS GmbH

Service Prozesse Retail
Hausanschrift: Fasanenweg 9, 70771 Leinfelden-Echterdingen
Postanschrift: Postfach 100258, 70746 Leinfelden-Echterdingen
Telefon: (0711)972-2437
Telefax: (0711)972-1949
E-Mail: [EMAIL PROTECTED]
Internet: http://www.t-systems.de



 -Ursprüngliche Nachricht-
 Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Gesendet: Donnerstag, 16. Mai 2002 17:52
 An: [EMAIL PROTECTED]
 Betreff: PDF from FOP to database as BLOB
 
 
 
 Hi,
 
 Currently we are dynamically creating our PDF documents using FOP in
 real-time and displaying them on the browser without a problem.  We've
 handled the CPU intensiveness of FOP by limiting the number 
 of users that
 can concurrently create a report to 1 or 2 (depending on the server).
 
 BUT - As the number of users requesting PDF reports on our application
 scales up we'll need a better solution.  Since our users can 
 wait for these
 reports we've decided to run a nightly job to create them and 
 store the
 PDFs in our database as a BLOB.  That way during peak usage hours our
 servers will only need to deal with returning the PDF to the browser.
 
 My question is, HOW, using FOP and JDBC can I get my PDF into 
 the database
 as a BLOB.
 The java.sql.PreparedStatement method setBinaryStream(int 
 parameterIndex,
 InputStreamx, int length) requires an input stream - how can 
 I get this
 from FOP?  If I instead us the java.sql.PreparedStatement 
 method setBlob
 (int i, Blob x) method - how can I create a BLOB from what I 
 have from FOP?
 
 
 Any Ideas would be very helpful.
 Thank You!
 Shawn
 


Re: AW: PDF from FOP to database as BLOB

2002-05-16 Thread Shawn.Lindstrom

Thank you! - That's just what I was looking for! I'll give it a try.
_

Hello Shawn,

you can make FOP write to an ByteArrayOutputStream.
By doing something like this:

ByteArrayOutputStream os = new ByteArrayOutputStream();

(driver+FOP stuff)...

driver.setOutputStream(os);

InputStream is = new ByteArrayInputStream(os.getBytes());

... now read from stream...

Hope this helps,
greetings,
Patrick