-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I am just starting to learn Rails, and working through Dave Thomas'' Rails book. I am trying to use PostgreSQL as the database, since that is what I will be using in production. I am working on a Windows XP box without a C compiler, so I have installed the postgres-pr-0.4.0-gem. In database.yml, I have: development: adapter: postgres-pr database: rails_development host: localhost username: rails I also tried using adapter: postgresql. When I try to invoke the page, I get: Errno::ECONNREFUSED (No connection could be made because the target machine actively refused it. - connect(2)): c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/v endor/mysql411.rb:47:in `initialize'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/v endor/mysql411.rb:47:in `new'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/v endor/mysql411.rb:47:in `real_connect'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/c onnection_adapters/mysql_adapter.rb:39:in `mysql_connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/c onnection_adapters/abstract_adapter.rb:136:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/c onnection_adapters/abstract_adapter.rb:136:in `connection='' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/c onnection_adapters/abstract_adapter.rb:100:in `retrieve_connection'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/b ase.rb:235:in `connection'' ActiveRecord is trying to use the mysql411 adapter, which is not going to work, as I have no MySQL installed. Looking at abstract_adapter, it should look try to require a library or a gem, so I thought postgres-pr would work. Can anyone tell me what I need to do? Thank you. - -- Jim McMaster mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQqYEI2aP5l7/atSJEQJ/pgCfdy+YQRkb02FCMMkoME6hq7yy2WIAnAt3 hfoPgFEB7j40sf43n4cosl58 =41TC -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sorry for posting twice, but this is different. I tried the same example from the Rails book on a Fedora 3 linux pox that does have the PostgreSQL driver installed. This time, my database.yml is: development: adapter: postgresql database: rails_development host: localhost username: jim The response from the server is: NameError in Admin#index uninitialized constant PGconn app/controllers/admin_controller.rb:8:in `list'' app/controllers/admin_controller.rb:3:in `index'' script/server:48 Show framework trace /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.4/lib/active_support/dep endencies.rb:183:in `const_missing'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/conn ection_adapters/postgresql_adapter.rb:36:in `postgresql_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/conn ection_adapters/abstract_adapter.rb:136:in `send'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/conn ection_adapters/abstract_adapter.rb:136:in `connection='' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/conn ection_adapters/abstract_adapter.rb:100:in `retrieve_connection'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.10.1/lib/active_record/base .rb:235:in `connection'' This time, I am indeed in the postgresql_adapter, but something seems to be missing. Can anyone tell me what? - -- Jim McMaster mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQqYP42aP5l7/atSJEQKklQCgw466H+US57W5PnJZzNQmjD0k9zsAoM/S pKCbBH5MnlEpnm4sTv3+vfua =6WRU -----END PGP SIGNATURE-----
On Jun 7, 2005, at 1:31 PM, Jim McMaster wrote:> I am just starting to learn Rails, and working through Dave Thomas'' > Rails book. I am trying to use PostgreSQL as the database, since > that is what I will be using in production. > > I am working on a Windows XP box without a C compiler, so I have > installed the postgres-pr-0.4.0-gem. In database.yml, I have: > > development: > adapter: postgres-pradapter: postgresql> database: rails_development > host: localhost > username: rails > > I also tried using adapter: postgresql. When I try to invoke the > page, I get:AFAIK the postgres-pr bindings do not work with PostgreSQL 8, which you''re likely running since you''re on Windows. Do investigate the C bindings (gem install postgres). jeremy
On Jun 7, 2005, at 2:21 PM, Jim McMaster wrote:> Sorry for posting twice, but this is different. I tried the same > example from the Rails book on a Fedora 3 linux pox that does have > the PostgreSQL driver installed. This time, my database.yml is: > > development: > adapter: postgresql > database: rails_development > host: localhost > username: jim > > The response from the server is: > > NameError in Admin#index > > uninitialized constant PGconnIn this case you haven''t installed the Ruby/PostgreSQL bindings. gem install postgres jeremy
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On , rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <> wrote:> > AFAIK the postgres-pr bindings do not work with PostgreSQL 8, which > you''re likely running since you''re on Windows. Do investigate the > C bindings (gem install postgres). > > jeremyYes, I am running PG8...darn it. Now I do have a problem. The book says I need Visual C (or C++) to compile C extensions. I do not have a license, nor do I have $800 to spend on it. Is there an alternative C compiler that would work? I can get GCC through Cygwin, but I am under the impression things compiled with that will only work under CygWin. - -- Jim McMaster mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQqZO7maP5l7/atSJEQIb7wCdFdndKzkuRDr8D+fWxAVPLj0vOvkAnjyT AlNoZAY6FmZa+0XFAfp6fM/z =ctRq -----END PGP SIGNATURE-----
I''ve managed to compile it using MinGW: http://www.mingw.org/ It takes some messing around though... Let me know if you have any trouble, I''m happy to help. -David Felstead On 6/8/05, Jim McMaster <jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On , rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <> wrote: > > > > > AFAIK the postgres-pr bindings do not work with PostgreSQL 8, which > > you''re likely running since you''re on Windows. Do investigate the > > C bindings (gem install postgres). > > > > jeremy > > Yes, I am running PG8...darn it. Now I do have a problem. The book > says I need Visual C (or C++) to compile C extensions. I do not have > a license, nor do I have $800 to spend on it. Is there an > alternative C compiler that would work? I can get GCC through > Cygwin, but I am under the impression things compiled with that will > only work under CygWin. > > - -- > Jim McMaster > mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org > > > -----BEGIN PGP SIGNATURE----- > Version: PGP 8.1 > > iQA/AwUBQqZO7maP5l7/atSJEQIb7wCdFdndKzkuRDr8D+fWxAVPLj0vOvkAnjyT > AlNoZAY6FmZa+0XFAfp6fM/z > =ctRq > -----END PGP SIGNATURE----- > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
David Felstead wrote:> It takes some messing around though... Let me know if you have any > trouble, I''m happy to help.I''m not sure I''ve totally understood this thread. Are you saying that Rails doesn''t work with PostgreSQL 8? Or is it just the postgres-pr bindings that don''t work with PG8 (but that the standard Rails PG adapter is fine)? What are the differences? I''m new to Ruby, Rails and PostgreSQL (I''ve plenty of PHP / MySQL experience, but have decided to make one big switch rather than two smaller ones), so forgive my ignorance if the above doesn''t even make sense, but I''m about to embark on a Rails project using PG8 and this thread is scaring me slightly! :-S Please could someone clarify exactly what it is that doesn''t work with PG8 and hopefully put my mind at rest? Many thanks, ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
Rails works great with PG8 with the native postgres bindings (http://ruby.scripting.ca/postgres/). postgres-pr is a pure Ruby (non-native) interface to PostgreSQL. On 6/7/05, Dave Silvester <dave-AJqNGCqIqVQ7cdpDWioORw@public.gmane.org> wrote:> David Felstead wrote: > > It takes some messing around though... Let me know if you have any > > trouble, I''m happy to help. > > I''m not sure I''ve totally understood this thread. Are you saying that Rails > doesn''t work with PostgreSQL 8? Or is it just the postgres-pr bindings that > don''t work with PG8 (but that the standard Rails PG adapter is fine)? What > are the differences? > > I''m new to Ruby, Rails and PostgreSQL (I''ve plenty of PHP / MySQL experience, > but have decided to make one big switch rather than two smaller ones), so > forgive my ignorance if the above doesn''t even make sense, but I''m about to > embark on a Rails project using PG8 and this thread is scaring me slightly! :-S > > Please could someone clarify exactly what it is that doesn''t work with PG8 and > hopefully put my mind at rest? > > Many thanks, > > ~Dave > > -- > > Dave Silvester > Rent-A-Monkey Website Development > Web: http://www.rentamonkey.com/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> adapter: postgres-pradapter: postgresql> Errno::ECONNREFUSED (No connection could be made because the target > machine actively refused it. - connect(2)):Did you take a look at the firewall settings? > I do not have a license, nor do I have $800 to spend on it. http://msdn.microsoft.com/visualc/vctoolkit2003/ - this is free -- Ioan Bizau http://ib.stalker.ro
On 6/8/05, Dave Silvester <dave-AJqNGCqIqVQ7cdpDWioORw@public.gmane.org> wrote:> David Felstead wrote: > > It takes some messing around though... Let me know if you have any > > trouble, I''m happy to help. > > I''m not sure I''ve totally understood this thread. Are you saying that Rails > doesn''t work with PostgreSQL 8? Or is it just the postgres-pr bindings that > don''t work with PG8 (but that the standard Rails PG adapter is fine)? What > are the differences? > > I''m new to Ruby, Rails and PostgreSQL (I''ve plenty of PHP / MySQL experience, > but have decided to make one big switch rather than two smaller ones), so > forgive my ignorance if the above doesn''t even make sense, but I''m about to > embark on a Rails project using PG8 and this thread is scaring me slightly! :-S > > Please could someone clarify exactly what it is that doesn''t work with PG8 and > hopefully put my mind at rest? > > Many thanks, > > ~Dave >Hi Dave, There are two postgres adapters for ruby (that I know of). The one you get when you try to run ''gem install postgres'' is a combination of C and Ruby code that requires that you have a compiler on your machine to compile the C libraries, to which the Ruby code is just a wrapper. The other, ''postgres-pr'' is a pure ruby adapter, so no compiler is required. I''ve only used the first of the two, on Linux, Mac OS X and Windows, so I can''t comment on whether postgres-pr works better or worse or otherwise - however, I have compiled it on all these platforms and they all work okay for me. On Linux worked straight out of the box (or gem), but I had to do some manual compiling on Mac OS X (standard gcc, but there were problems with library paths) and Windows (using MinGW - again, some tweaking is requried to point it to the right libraries). So to sum up - everything SHOULD work with Rails and PG8 on any of the supported platforms, it may just take some work. :) Hope that helps! -David Felstead
Rails does work with the latest PostgreSQL. I''m not particularly good at getting new stuff configured, but I did manage to make that work. So I know it''s possible! I believe I found a guide somewhere online that showed specifically how to connect Rails to PostgreSQL. My database.yml: development: adapter: postgresql database: rjgc host: localhost username: rjgcuser password: blank test: adapter: postgresl database: rjgc_test host: localhost username: rjgcuser password: blank production: adapter: postgresl database: rjgc_production host: localhost username: rjgcuser password: blank The only problem I had after I got it connected was with respect to naming policies for tables and their (autoincrementing) keys, but I solved that. I forget the details. On 6/8/05, Ioan Bizau jr. <ib-1ls4L0tObC6vSplVBqRQBQ@public.gmane.org> wrote:> > > adapter: postgres-pr > > adapter: postgresql > > > Errno::ECONNREFUSED (No connection could be made because the target > > machine actively refused it. - connect(2)): > > Did you take a look at the firewall settings? > > > I do not have a license, nor do I have $800 to spend on it. > > http://msdn.microsoft.com/visualc/vctoolkit2003/ - this is free > > -- > Ioan Bizau > http://ib.stalker.ro > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
David Felstead wrote:> So to sum up - everything SHOULD work with Rails and PG8 on any of the > supported platforms, it may just take some work. :)Thanks, that clears things up perfectly! I was just worried someone was going to say Rails didn''t work with PG8, only PG7, or something along those lines, but I was pretty sure that wouldn''t be the case. I''m running Gentoo here so I''m already very good friends with GCC! Development on Linux, production on FreeBSD, so hopefully no problems. :-) Cheers, ~Dave -- Dave Silvester Music Technology Junkie | Rentable Website Monkey http://www.mu-sly.co.uk | http://www.rentamonkey.com
On 6/7/05, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> AFAIK the postgres-pr bindings do not work with PostgreSQL 8, which > you''re likely running since you''re on Windows. Do investigate the C > bindings (gem install postgres). >I''m using postgres-pr to talk to postgresql 8. I run on windows, using cygwin. I''ve installed ruby from cygwin, compiled rubygems, then installed rails and postgres-pr. My database runs on a different server. My database.yml looks like: development: adapter: postgresql database: rails host: earth username: jason password: xxxxx You must make sure to enable password authentication on postgresql if not on the same machine. This is done by editing pg_hba.conf. I''ve no experience running postgresql on windows though, so I wonder if that is the source of this problem? Jason
On 6/7/05, Jim McMaster <jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On , rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <> wrote: > > > > > AFAIK the postgres-pr bindings do not work with PostgreSQL 8, which > > you''re likely running since you''re on Windows. Do investigate the > > C bindings (gem install postgres). > > > > jeremy > > Yes, I am running PG8...darn it. Now I do have a problem. The book > says I need Visual C (or C++) to compile C extensions. I do not have > a license, nor do I have $800 to spend on it. Is there an > alternative C compiler that would work? I can get GCC through > Cygwin, but I am under the impression things compiled with that will > only work under CygWin. >The Microsoft C/C++ compiler and linker are free. Its the IDE that costs $$$. http://msdn.microsoft.com/visualc/vctoolkit2003/ Jason
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On , rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <> wrote:>> adapter: postgres-pr > > adapter: postgresql > >> Errno::ECONNREFUSED (No connection could be made because the >> target machine actively refused it. - connect(2)): > > Did you take a look at the firewall settings? >This was not a firewall problem. It was the attempted connection to MySQL that failed, since I do not have that installed.> > I do not have a license, nor do I have $800 to spend on it. > > http://msdn.microsoft.com/visualc/vctoolkit2003/ - this is freeThank you for the reference. I dod not know about it. I installed the compiler, opened the Visual C++ Toolkit Command Prompt and tried to install the postgres gem. The make failed. I then installed the Microsoft platform SDK, opened a Windows XP 32-bit Debug command window, and got the same results: C:\Program Files\Microsoft Platform SDK>gem install postgres C:\Program Files\Microsoft Platform SDK>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install postgres Attempting local installation of ''postgres'' Local gem file not found: postgres*.gem Attempting remote installation of ''postgres'' Building native extensions. This could take a while... ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.1 for inspection. ruby extconf.rb install postgres\nchecking for cygwin32_socket() in wsock32.li b... no checking for socket() in socket.lib... no checking for gethostbyname() in inet.lib... no checking for gethostbyname() in nsl.lib... no checking for sys/un.h... no checking for socket()... no checking for cygwin32_socket()... no Results logged to c:/ruby/lib/ruby/gems/1.8/gems/postgres-0.7.1/gem_make.out C:\Program Files\Microsoft Platform SDK> It doesn''t seem to find the header files. Does anyone have any suggestions? Thank you. - -- Jim McMaster mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQqdBGWaP5l7/atSJEQJg5gCfeIWsgVdXV+HV6EuvwPUVKeOMzoMAnjOI 0OIcBxDK8TV3t0yY8ZcSkffd =BS6D -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On , rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <> wrote:> On Jun 7, 2005, at 2:21 PM, Jim McMaster wrote: >> Sorry for posting twice, but this is different. I tried the same >> example from the Rails book on a Fedora 3 linux pox that does have >> the PostgreSQL driver installed. This time, my database.yml is: >> >> development: >> adapter: postgresql >> database: rails_development >> host: localhost >> username: jim >> >> The response from the server is: >> >> NameError in Admin#index >> >> uninitialized constant PGconn > > In this case you haven''t installed the Ruby/PostgreSQL bindings. > gem install postgres > > jeremyMy sysadmin tried to install the gem, but it died complaining it could not find the PostgreSQL libraries. He then manually downloaded http://ruby.scripting.ca/postgres/ruby-postgres-0.7.1.tar.gz as suggested by the Rails book. He then did the following: - -------------------- Initial go: {rpuckett@dev14dt:~/skip_backup/ruby-postgres-0.7.1 }ruby extconf.rb checking for cygwin32_socket() in -lwsock32... no checking for socket() in -lsocket... no checking for gethostbyname() in -linet... no checking for gethostbyname() in -lnsl... yes checking for sys/un.h... yes checking for socket()... yes checking for hsterror()... no checking for gethostname()... yes checking for PQsetdbLogin() in -lpq... no Could not find PostgreSQL libraries: Makefile not created After specifying postgresql stuff: ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include \ --with-pgsql-lib-dir=/usr/local/pgsql/lib {rpuckett@dev14dt:~/skip_backup/ruby-postgres-0.7.1 } ruby extconf.rb - --with-pgsql-include-dir=/usr/local/pgsql/include \> --with-pgsql-lib-dir=/usr/local/pgsql/libchecking for cygwin32_socket() in -lwsock32... no checking for socket() in -lsocket... no checking for gethostbyname() in -linet... no checking for gethostbyname() in -lnsl... yes checking for sys/un.h... yes checking for socket()... yes checking for hsterror()... no checking for gethostname()... yes Using PostgreSQL include directory: /usr/local/pgsql/include Using PostgreSQL lib directory: /usr/local/pgsql/lib checking for PQsetdbLogin() in -lpq... yes checking for PQsetClientEncoding()... yes checking for pg_encoding_to_char()... yes checking for PQescapeString()... yes creating Makefile make sudo make install: install -c -p -m 0755 postgres.so /usr/lib/site_ruby/1.8/i386-linux - --------------------------------- It looks like the library was created, but is this the "Ruby/PostgreSQL bindings" you were talking about? The error in the gem installation was the same as in the "initial go" mentioned above. Is there a way to specify the postgres include and lib locations in the gem install command? Thank you. - -- Jim McMaster mailto:jim.mcmaster-Wuw85uim5zDR7s880joybQ@public.gmane.org -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQqdDuWaP5l7/atSJEQJKSACfbTGlif4tQWn30UI3G+0YZNACqqAAoKgH O+ZaFKcOBc8MXDjRXMzsPfSX =4dT7 -----END PGP SIGNATURE-----