If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Search for text in a blob field?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-11, 08:49
thingsToDB2 thingsToDB2 is offline
Registered User
 
Join Date: Nov 2011
Posts: 2
Search for text in a blob field?

We are using DB2 9.7 on a Windows platform and have a database which stores a number of binary files (mostly word documents) in a blob column. We have been asked by our client if it is possible to do a text search of said stored documents.
I did not think this was possible in DB2 and was planning on using the java POI library to extract the docs and then search on the text I can extract, but I read that the Net Search Extender feature of DB2 might allow us to do this right in DB2.
Does the Net Search Extender allow me to query a blob field directly?

eg. Select * from myTable where blobField like '%searchString%'

When I click on a database in control center, I do see a 'Net Search Extender' option in which I can select 'Enable Database For Text'.

Sorry if this is a dumb question, I'm no DBA (and we have none), just a java developer trying to stumble through the client's requirements.
Reply With Quote
  #2 (permalink)  
Old 11-09-11, 09:12
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
It would hard to do a text search on a blob column since it holds binary data. You would have to search for the hex values, probably after you cast it as varchar for bit data (but not sure if the cast is still required in latest release).

Word documents (docx) are now stored in compressed format, which makes things even more difficult.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 11-09-11, 09:48
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
you have to install netsearch code and there is even a special package with drivers (will have to search the name) that is used with db2 CM that allows you to search in word documents. about the compress setting - this I can not confirm
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #4 (permalink)  
Old 11-09-11, 09:54
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Net Search Extender (and DB2 Text Search, which replaces it) work by indexing text fields, then you use certain functions (like CONTAINS) to search the text index and retrieve the original document. Normally only text-based types (like text, RTF, HTML, XML) are indexed. You can also index other document formats, but you'll need 3d party libraries for that, e.g. http://www.oracle.com/us/technologie...ded/025613.htm
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On