db2全文检索

本文介绍了如何在Windows环境下安装和配置DB2 Text Information Extender,包括启动服务、安装DataLink jar包、创建全文索引和查询等步骤,帮助开发者实现文本文档的SQL查询功能。
 

DB2 Text Information Extender is one of a family of DB2 Extenders. It enables programmers to include SQL queries for text documents in their applications. Other Extenders can search images, or handle XML documents and spatial data.

文件 地址 http://blog.itpub.net/resource/901/657


DB2 TIE是独立于DB2的一个单独的产品,但其使用必须依赖DB2,对运行环境要求如下:

l         Windows NT Version 4.0 with Service Pack 5, or higher

l         Windows 2000

l         RISC System/6000 and AIX Version 4.2 or higher

l         Solaris Version 2.6 or higher

l         DB2 Version 7.2

Windows平台下的步骤如下:

1. Use the setup.exe to transfer the files from the package to the target machine.

2. Reboot the system after data transfer.

3. Call db2text start to start the DB2 Text Information Extender update and locking services.

4. To deinstall the product use the Add/Remove Programs icon in the Control Panel.

5. 如果需要从对象文件中进行全文检索,还需安装DataLink jarctedludf.jar: In the db2 command line processor execute the following command: call sqlj.install_jar('file:/// /sqllib/java/ctedludf.jar','ctedludf_jar') (注:execute sqlj.remove_jar('ctedludf_jar') to unregisters the jar file. It can be used in both environments.)

以下创建过程假设以db2admin用户执行,操作在本地itsowsad数据库实例上进行。

1.       在“服务”中修改登录身份,确保以db2admin而不是本地系统用户运行DB2EXT-DB服务。启动TIE服务(或者执行:db2text start.

2.       Control Center中以administrator身份连接,为db2admin用户授权(DatabaseSchema权限)

3.       启动DB2实例的全文检索支持。在命令窗口中,执行 db2text enable database for text connect to itsowsad user db2admin using dam。返回成功提示“CTE0001 操作成功完成。”

4.       创建全文索引。

a)         建表:db2 create table sample (name varchar(60) primary key not null,description varchar(400))

b)        插入数据:db2 insert into sample values ('First row','This product comes from IBM') db2 insert into sample values ('Second row','and is named DB2 Text Information Extender')

c)        建索引:db2text CREATE INDEX sample_inx ON sample (description) FOR TEXT connect to itsowsad user db2admin using dam,返回“CTE0001 操作成功完成。”

5.       更新索引(增量索引):db2text update INDEX sample_inx FOR TEXT connect to itsowsad user db2admin using dam,返回“CTE0001 操作成功完成。”

6.       检查索引状态:db2 SELECT indexname, number_docs FROM db2ext.textcolumns

7.       执行查询:db2 SELECT description FROM sample WHERE CONTAINS (description,'"IBM"') = 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值