Windows 对 Ruby 安装 PostgreSQL 驱动程序

1. 安装 PostgreSQL 适配器驱动程序
详细步骤参见:http://glauche.de/2007/12/21/installing-native-postgres-gem-for-ruby/
运行 gem install ruby-postgres,在列表中选择对应的平台(mswin32)进行安装,如:

D:\source\Personal\lnj\tour>gem install ruby-postgres

Bulk updating Gem source index for: http://gems.rubyforge.org

Select which gem to install for your platform (i386-mswin32)

1. ruby-postgres 0.7.1.2006.04.06 (ruby)

2. ruby-postgres 0.7.1.2006.04.06 (mswin32)

3. ruby-postgres 0.7.1.2006.04.05 (mswin32)

4. ruby-postgres 0.7.1.2006.04.05 (ruby)

5. Skip this gem

6. Cancel installation

> 2

Successfully installed ruby-postgres-0.7.1.2006.04.06-mswin32

Installing ri documentation for ruby-postgres-0.7.1.2006.04.06-mswin32...

Installing RDoc documentation for ruby-postgres-0.7.1.2006.04.06-mswin32...



2. 测试驱动程序
在控制台中运行 irb,输入命令 require "postgres",如果返回 true,说明链接成功,如果出现错误:
* 报错:"没有找到 libpq.dll,因此这个应用程序未能启动",将 C:\Program Files\PostgreSQL\8.3\bin\libpq.dll 复制到 C:\ruby\bin。
* 报 错:"无法定位序数 284 于动态链接库 SSLEAY32.dll 上",可能是 ruby 所用 SSLEAY32.dll 的版本号低于 postgresql 使用的,将 C:\Program Files\PostgreSQL\8.3\bin\libeay32.dll 和 ssleay32.dll 替换 C:\ruby\bin 下同名文件。
* 报错:"没有找到 xxx.dll,因此这个应用程序未能启动",将 C:\Program Files\PostgreSQL\8.3\bin\xxx.dll 复制到 C:\ruby\bin。
* 可能需要复制下列文件:
o libeay32.dll 替换
o ssleay32.dll 替换
o libpq.dll
o libintl3.dll
o libiconv2.dll
o krb5_32.dll
o comerr32.dll
o k5sprt32.dll
o gssapi32.dll
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值