This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Install postgres-pr gem using Gems tool, and then try to follow the Weblog tutorial at http://www.netbeans.org/kb/60/ruby/rapid-ruby-weblog.html, using postgres as the target database rather than mysql. When you try to apply the migration, you get the following error: rake aborted! uninitialized constant PostgresPR::Connection::UNIXSocket /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:477:in `const_missing' /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:140:in `establish_connection' /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:25:in `initialize' /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in `new' /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/postgres-compat.rb:23:in `initialize' /export/home/dv136566/netbeans-6.0rc1/ruby1/jruby-1.0.2/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/postgresql_adapter.rb:23:in `new'
I looked at the code, and what's happening is the Ruby postgres driver postgreql-pr is trying to use the local file socket rather than a TCP socket, as this is the faster mechanism when the PostgreSQL client and server are on the same machine. I checked, and /tmp/.s/PGSQL.5432 exists, so the file socket is available. I also checked, and I can connect to PostgreSQL just fine using the JDBC driver through the NetBeans DB Explorer. I googled for the error above, and no such luck. Also the PostgreSQL wiki page at http://wiki.rubyonrails.org/rails/pages/PostgreSQL had no tips for this. I looked at the top of connection.rb and it does a 'require socket'. I wonder if that's somehow not available in the NB version? I looked for the gem 'socket' through the Gem manager, but it doesn't seem to exist. It looks like 'socket' is part of the Ruby standard library (http://www.ruby-doc.org/stdlib/libdoc/socket/rdoc/index.html). Does JRuby not provide an implementation for UNIX sockets (as compared with TCP/IP sockets)?
Created attachment 53229 [details] Messages log file
Found a reasonable workaround: use the TCP/IP connection rather than the UNIX socket connection. To do this, edit the database.yml file and uncomment the following two lines: host: localhost port: 5432 Downgrading to a P3
Checking to see when you might evaluate this bug and assign it a target milestone. IMHO we really should fix this for 6.1, the error is quite confusing and everyone will hit it who tries to use PostgreSQL.
Do you think that we should use TCP/IP connection by default when the user has selected postgres as the target database or that the issue with the socket connection should be fixed? AFAICT the former can be done on the NB side, but the latter seems like a JRuby issue and should be filed against it. Probably would be good to test with JRuby 1.0.3 first though, perhaps it has been fixed already - I'll try that tomorrow.
You're right, the underlying issue is the lack of socket support, but I thought that was not going to get fixed any time soon. If it's been fixed in JRuby, great! If not, I say we log the bug, and then work around it by using TCP/IP for now. Thanks, David
I tried with JRuby 1.0.3 and the problem persists, so I filed http://jira.codehaus.org/browse/JRUBY-1996. As a workaround I'll change the db configuration to use the TCP/IP connection when generating projects that use JRuby and PostgreSQL (until the JRuby issue gets fixed).
The JRuby issue I filed was closed, JRuby doesn't support sockets. So I changed the database configuration generator to automatically uncomment the host and port attributes that Rails generates but leaves commented out. In addition, host and port are always used when using a PostgreSQL connection that is registered in the IDE. http://hg.netbeans.org/main/rev/507ef2bb7bda