六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 262|回复: 0

Windows 对 Ruby 安装 PostgreSQL 驱动程序

[复制链接]

升级  0%

58

主题

58

主题

58

主题

举人

Rank: 3Rank: 3

积分
200
 楼主| 发表于 2013-1-30 01:36:35 | 显示全部楼层 |阅读模式
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
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表