How to insert PDF file into oracle database

1,676 views
Skip to first unread message

nand

unread,
Jan 7, 2009, 9:33:06 PM1/7/09
to Java EE (J2EE) Programming with Passion!
I have requirement to insert a pdf document from client pc into oracle
database, any inputs on this
is greatly appreciated

Rudi

unread,
Jan 8, 2009, 4:57:00 PM1/8/09
to Java EE (J2EE) Programming with Passion!
Hi,

You can check documentation on Oracle Blogs and how to deal with
them.
The document will be inserted as a Blog or Large Blog into the
database.

Atul Suri

unread,
Jan 8, 2009, 1:08:35 PM1/8/09
to java-ee-j2ee-progr...@googlegroups.com
Assuming you dont want to store the name of the file and path in database but the actual contents of the file.
 
You will convert the pdf to blob and save it to database.
 
1)In Database, you will need a Table which has column of BLOB data type field.
 
2) In Java java.sql.Blob has functions to read / write blobs. Use this to read the file and convert it to stream .
3) In database Using PreparedStatement.SetBinaryStream(....) function you should be able to save it.
 
 
Atul

Atul Suri

unread,
Jan 9, 2009, 11:52:43 AM1/9/09
to java-ee-j2ee-progr...@googlegroups.com
JPG can be stored in BLOB. BLOB Stands for Binary Large Object Data, essentially anything that is not text can be placed in there. So PSD,AI, GIF , etc.
 
On Side Note : For files like word, text , or  pdf in which you will need to search within the contents of the file  CLOB is used..
 
Atul


 
On Fri, Jan 9, 2009 at 4:35 AM, Ice-Man <derlon.a...@gmail.com> wrote:
     Hi Atul,

   And how could we do to retrieve the .PFD (data) and make it available (as a link) for instance??!
  (Obs.: and what about graphic format files (.JPG, etc.): could do the same (BLOB field)??!)
 
Ice-Man
 
 
2009/1/8 Atul Suri <atul...@gmail.com>

prince

unread,
Jan 9, 2009, 3:31:33 AM1/9/09
to Java EE (J2EE) Programming with Passion!
try External file option in oracle or blog datatype

Atul Suri

unread,
Jan 12, 2009, 4:32:48 PM1/12/09
to java-ee-j2ee-progr...@googlegroups.com
To create a link to PDF.
 
You can to read the data from database, convert it to a actual physical file on the path , and then set the link to this path  for user to download. after user request the file.
 
However this is inefficent way to show pdf it. Couple of Ideas
 
> You can store the actual file to make  links work without additional overhead.Also store in file database in BLOB or CLOB. 
Or
> You can store actual file, You can convert file into keywords and store keywords for search.
 

 
On Mon, Jan 12, 2009 at 3:50 AM, Ice-Man <derlon.a...@gmail.com> wrote:
        Atul,
 
   Oh yeah! I already use CLOB  when I have to store (in a field) a text with more then 4000Bytes (by the way, I have to use a storedProcedure for text with more then 8000Bytes).
  But, And what about: how could we do to retrieve the .PFD (data) and make it available (as a link) for example??!

Ice-Man
 

2009/1/9 Atul Suri <atul...@gmail.com>



--
Derlon

Ao encaminhar esta mensagem (ou qualquer 1 q se destine a mim tb), não se esqueça de retirar o meu nome e o meu End. de E-Mail e coloque todos os End.s dos destinatários em Cópia Oculta - CcO (BCc). Ajude a combater o Spam!

Reply all
Reply to author
Forward
0 new messages