Topic: WinXPro, Ruby on Rails and PostgreSQL

Hello folks, I'm starting from scratch learning Ruby on Rails (RoR) with PostgreSQL (pgsl) as my database engine.  A friend recommended pgsl over MySQL and that's why I've decided to go against the grain.  The book I'm working through is Beginning Ruby on Rails by Steven Holzner and uses MySQL.

Long story short, after several hours of trial and error I finally configured RoR to work with pgsl!!  This forum and siz's post (http://railsforum.com/viewtopic.php?pid=59937#p59937) was helpful. 

Here are the steps I used to get Ruby on Rails and PostgreSQL installed on Windows XP Professional SP3.  Your comments and feedback are appreciated.


1.  Install Ruby on Rails 1.8.6-27 Release Candidate 2 (ruby186-27_rc2.exe) from http://rubyforge.org/frs/?group_id-167
2.  During Ruby-186-27 Setup, check "Enable RubyGems" component to install
2.  Install PostgreSQL 8.3.7-1 (postgresql-8.3.7-1-windows.exe) from http://www.enterprisedb.com/products/pg … do#windows
3.  Cancel PostgreSQL's Application Stack Builder wizard
4.  Add the ruby\bin and the PostgreSQL\8.3\bin directories to your path statement

-- Next series of commands are entered at the command line (cmd)
5.  run "gem install rails
6.  "gem update --system"
7.  "ruby -v"  (should echo back "ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]")

(optional Mongrel install) "gem install mongrel mongrel_cluster"

8.  "gem install ruby-postgres"  (if that fails use "postgres-pr" instead of "ruby-postgres")
9.  in irb type "require 'postgres'" (should return =>true)
    ... if ordinal 284... library SSLEAY32.dll error occurs then
        - "exit" irb
        - copy LIBEAY32.dll and SSLEAY32.dll from PostgrenSQL\8.3\bin
        - overwrite LIBEAY32.dll and SSLEAY32.dll in Ruby\bin
        - redo #9 step in irb

The following link (http://www.robbyonrails.com/articles/20 … sql-on-osx) contails additional steps to verify configuration.  Despite the article being written for OS X, this will work on WinXP.

Note: 4th bullet under "Test Rails + PostgreSQL" talks about generating a new model to test with.  The command cited is "./script/generate model Argonista"  I had to use "ruby script/generate model Argonista" for this step to work.

Funny how easy this looks after the fact.  Its like a no-brainer now, but wasn't last night!  I'm sure I'll be crying for help on another simple item.  Please be patient with me, I'm hoping to learn this stuff.

Re: WinXPro, Ruby on Rails and PostgreSQL

Thats awesome, thanks for the FYI on how to make it work with Postgres. I never got into that much, as I've really never seen the benefit in using it over MySQL so just stuck with MySQL.

The only time I ever use anything different personally, is when I'm running very high load applications, in which I use Oracle, which Rails is also compatible with.

3

Re: WinXPro, Ruby on Rails and PostgreSQL

Thanks.  your post helped me too.

gem install postgres-pr   worked

i tried and failed with the following

gem install pg
gem install --include-dependencies postgres
gem install postgres

Platform
c:\Ruby19\work\t2>ruby script/about

About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.4
Active Record version     2.3.4
Active Resource version   2.3.4
Action Mailer version     2.3.4
Active Support version    2.3.4
Application root          c:/Ruby19/work/t2
Environment               development
Database adapter          postgresql

Re: WinXPro, Ruby on Rails and PostgreSQL

Funny, for me the only working solution was
      gem install pg

(After the same setup as you had)


About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.6
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          C:/proj/247imagez
Environment               development
Database adapter          postgresql
Database schema version   20100226113825

Re: WinXPro, Ruby on Rails and PostgreSQL

Thank you for this nice tutorial.
I got following errors while I'm creating new project.

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occured while installing json (1.6.4), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.4'` succeeds before bundling.

Looking for suggestion.

Re: WinXPro, Ruby on Rails and PostgreSQL

hmmmm,  I got the answer.... Google.

To fix it:
1. Download Devkit in the ruby website. Download the one under the "Development Kit"
2. Extract the file
3. run "ruby dk.rb init"
4. run "ruby dk.rb install"

Re: WinXPro, Ruby on Rails and PostgreSQL

Now this is main errors.

Can any one help to me to fig it out.

received invalid response to SSL negotiation: -

received invalid response to SSL negotiation: -
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `connect'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:312:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:28:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:304:in `new_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:261:in `loop'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:261:in `block in checkout'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:260:in `checkout'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:162:in `connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:115:in `retrieve_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:89:in `connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:110:in `rescue in create_database'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:54:in `create_database'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:42:in `block (2 levels) in <top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_lev
el'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin
g'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin
g'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "u
sername"=>"employee", "password"=>"milind", "pool"=>5, "timeout"=>5000}
received invalid response to SSL negotiation: -
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:1076:in `connect'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:312:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:28:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:304:in `new_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:261:in `loop'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:261:in `block in checkout'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:260:in `checkout'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:162:in `connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:115:in `retrieve_connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:89:in `connection'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:110:in `rescue in create_database'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:54:in `create_database'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/railtie
s/databases.rake:44:in `block (2 levels) in <top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_lev
el'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin
g'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handlin
g'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "d
atabase"=>"employee", "pool"=>5, "username"=>"employee", "password"=>"milind"}

Last edited by makewebapp (2011-12-27 09:22:22)