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
详细步骤参见: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