File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Search for Text in a BLOB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Search for Text in a BLOB" Watch "Search for Text in a BLOB" New topic
Author

Search for Text in a BLOB

Rohit Kedia
Ranch Hand

Joined: Apr 24, 2010
Posts: 79
Hi,
I am using a this Query to search a Text from a BLOB field. I am getting results for .doc ,.xls, .ppt, .txt files. But I am unable to find any help for searching in a .docx or any 2007 Office file formats and also for PDF files in a BLOB fields.

Please help me in this Issue.


Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The DB has no notion of searching inside of BLOBs in general, or of structured file formats specifically. You could extract the text from those documents and store it in an additional text field, which could then be searched by SQL. The Apache POI library can do this for Office file formats, and Apache PDFBox for PDFs.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

Rohit,
A BLOB doesn't store text. It stores binary data.

As Lester noted, the database has no way of knowing what is in your BLOB. It could be a Word document or it could be a bunch of random bytes.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

Some databases (Oracle for example) allow BLOB-like data types like CLOB/XML that do allow searching.


My Blog: Down Home Country Coding with Scott Selikoff
 
wood burning stoves
 
subject: Search for Text in a BLOB
 
Similar Threads
Search BLOB for text
How to retreive a blob....
Saving Japanese Characters in Oracle Blob using Java program
Reading From a Binary Large Object(BLOB)
How to upload a byte array into BLOB column?