uninitialized constant PGconn

Posted by Christopher Rigor on January 11, 2010 
Filed Under Ruby on Rails

I’m successfully using Postgres for development. My stack includes ruby 1.8.7, rails 2.3.4, and pg 0.8.0. One day, I get an error

NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn

I didn’t update Postgres or the pg gem so I don’t see a reason for it to stop working. Then I remember that I installed jruby and installed the activerecord adapater. Instead of using jgem install, I used gem install. This installed the gems (activerecord-jdbc-adapter, activerecord-jdbcmysql-adapter and jdbc-mysql) on my ruby 1.8.7 system. I left the gems installed thinking they wouldn’t cause any error.

So, if you encounter uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn check if you have the jdbc adapter gems for jruby.

I hope this helps someone.

Comments

  • Mleger45

    but gem Install what?? I mean you put "sudo gem install ..." ?? Thanks!!

  • Lsatenstein

    I too am looking for PGconn structure definition. I have an old PGP package dated 2004, from SourceForge, and I am trying to get it to compile and install.

  • Teufelss

    Thank you dude! It was very helpful to me ... :)

  • Peter

    What is even more funny that a gem for MySQL causes such a weird problem for the Postgre adapter..

  • crigor

    It's not the mysql adapter that causes the error but the AR-JDBC. Nick Sieger explained this on his blog. http://blog.nicksieger.com/art...

blog comments powered by Disqus