Hi there, I''ve been trying for a few hours now to get RoR and postgresql talking - but I''m very confused about what''s going on (I''m running windows btw). I haven''t created a database in postgresql (I''m assuming that RoR will do that?) my database.yml looks like this: production: adapter: ruby-postgres database: rails_production username: postgres password: myPassword test: adapter: ruby-postgres database: rails_test username: postgres password: myPassword development: adapter: ruby-postgres database: rails_development username: postgres password: myPassword When I created my rails app, I put a flag -d postgresql I have installed different database adapters (ruby-postgres, activerecord-jdbcpostgresql-adapter, postgres-pr). I''ve tried writing adapter: postgresql in the .yml file. But when I try to run the server (ruby script/server), I get the following error msg: G:/program files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_recor d/connection_adapters/abstract/connection_specification.rb:232:in `establish_con nection'': Please install the postgresql adapter: `gem install activerecord-postg resql-adapter` (no such file to load -- pg) (RuntimeError) I try what this msg says, but it doesn''t work, it just says this: G:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test>gem install ac tiverecord-postgresql-adapter ERROR: could not find gem activerecord-postgresql-adapter locally or in a repos itory I''m guessing that RoR has a postgresql database driver installed, and that the gems are acting as database adapters? Any help you can give me will be soooo appreciated - I''m really keen to learn RoR, but it''s these little things(Installation) that are holding me back. Thanks, Louis -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Louis I use postgres with rails and I''ll give you some tips rails doesn''t create databases for you out of the box (as far as I know.) You need to create the databases yourself, or write some code in your app to create them for you. Installing the postgres driver on windows is tricky. There exists no actively supported driver for windows. The ruby-pg project doesn''t build on windows (at least not reasonably easily), ruby-postgres is inactive. postgres-pr compatibility was broken recently in edge rails and is unlikely to ever be restored as postgres-pr is inactive. If you are using rails installed via rubygems, you can install postgres-pr but at some future release of rails this will fail. To install it do: gem install postgres-pr If it still complains after that do: gem install postgres Then you should be set... for now. That is probably the best way to start, but eventually you will want to be using ruby-postgres instead. The trick to getting that driver working is to copy 2 dll files to your c:\ruby\bin folder from your C:\program files\posgresql\lib folder. I think these 2 files are libeay32.dll and ssleay32.dll If those aren''t the correct files, there are several blog articles out there that mention which dll''s have to be copied over. I can tell you from personal experience that using postgresql with rails is a major pain in the ass. I''ve found so many nasty bugs involving posgresql in activerecord. It sounds as if you don''t know what you''re doing at all yet, in which case I''d advise just using mysql instead until you''re more comfortable. Do you have a good reason for using postgresql? Miles On Fri, Sep 12, 2008 at 5:09 PM, Lou Mann <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi there, I''ve been trying for a few hours now to get RoR and postgresql > talking - but I''m very confused about what''s going on (I''m running > windows btw). > > I haven''t created a database in postgresql (I''m assuming that RoR will > do that?) > my database.yml looks like this: > > production: > adapter: ruby-postgres > database: rails_production > username: postgres > password: myPassword > > test: > adapter: ruby-postgres > database: rails_test > username: postgres > password: myPassword > > development: > adapter: ruby-postgres > database: rails_development > username: postgres > password: myPassword > > > When I created my rails app, I put a flag -d postgresql > I have installed different database adapters (ruby-postgres, > activerecord-jdbcpostgresql-adapter, postgres-pr). I''ve tried writing > adapter: postgresql in the .yml file. > > But when I try to run the server (ruby script/server), I get the > following error msg: > > G:/program > files/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_recor > d/connection_adapters/abstract/connection_specification.rb:232:in > `establish_con > nection'': Please install the postgresql adapter: `gem install > activerecord-postg > resql-adapter` (no such file to load -- pg) (RuntimeError) > > I try what this msg says, but it doesn''t work, it just says this: > G:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test>gem > install ac > tiverecord-postgresql-adapter > ERROR: could not find gem activerecord-postgresql-adapter locally or in > a repos > itory > > > I''m guessing that RoR has a postgresql database driver installed, and > that the gems are acting as database adapters? > > Any help you can give me will be soooo appreciated - I''m really keen to > learn RoR, but it''s these little things(Installation) that are holding > me back. > > > > Thanks, > > Louis > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m curious if you can be more detailed on the bugs you''ve found with ActiveRecord involving PostgreSQL. I''ve used PostgreSQL with Rails for several projects and have had only 1 problem relating to using "infinity" with timestamps that was in fact rather easy to work around. I''ve used ActiveRecord''s finders, find_by_sql, and even direct SQL execution and retrieving results from all of those. Jim Crate Que Viva Development, LLC On Sep 13, 6:22 am, "Miles Georgi" <azi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I can tell you from personal experience that using postgresql with > rails is a major pain in the ass. I''ve found so many nasty bugs > involving posgresql in activerecord.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jim, here''s the bugs I''ve reported to rails.lighthouseapp.com http://rails.lighthouseapp.com/projects/8994/tickets/611-cannot-write-certain-binary-data-to-postgresql-bytea-columns-in-2-1-0 http://rails.lighthouseapp.com/projects/8994/tickets/861-fix-for-a-transaction-problem-with-change_column-on-postgresql-if-bad-arguments-passed-in http://rails.lighthouseapp.com/projects/8994/tickets/771-postgresql-8-3-doesn-t-like-single-quoted-role-names-in-the-owner-clause http://rails.lighthouseapp.com/projects/8994/tickets/988-is-postgres-pr-driver-no-longer-supported-problem-with-new-transaction_active-method All of these cost me valuable hours of my time, and there''s been some postgresql related bugs I haven''t bothered to report and am too lazy to go find my monkey patches and modifications to my local rails repository to list them. There''s been periods of time where I''ve spent more of my time debugging activerecord code than working on my projects. On Sat, Sep 13, 2008 at 6:58 AM, Jim <jimcfl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m curious if you can be more detailed on the bugs you''ve found with > ActiveRecord involving PostgreSQL. I''ve used PostgreSQL with Rails > for several projects and have had only 1 problem relating to using > "infinity" with timestamps that was in fact rather easy to work > around. I''ve used ActiveRecord''s finders, find_by_sql, and even > direct SQL execution and retrieving results from all of those. > > Jim Crate > Que Viva Development, LLC > > > On Sep 13, 6:22 am, "Miles Georgi" <azi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I can tell you from personal experience that using postgresql with >> rails is a major pain in the ass. I''ve found so many nasty bugs >> involving posgresql in activerecord. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Miles Georgi wrote:> That is probably the best way to start, but eventually you will want > to be using ruby-postgres instead. The trick to getting that driver > working is to copy 2 dll files to your c:\ruby\bin folder from your > C:\program files\posgresql\lib folder. I think these 2 files are > libeay32.dll and ssleay32.dll > > If those aren''t the correct files, there are several blog articles out > there that mention which dll''s have to be copied over.Yeah - can''t see those dll''s. Anyway, I''m using netbeans now for Ruby on rails - it found postgresql ok, so I don''t know what it''s doing that I can''t! I''m happy to use netbeans for now. Thanks for your help -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---