HELP! Please! I’m pulling my hair out!
Ok, I’m just trying to get jruby to work with postgresql. With
postgresql server running, and webrick running, I create a project,
with:
rails new myproj
I edit the file database.yml to be:
development:
adapter: jdbcpostgresql
database: db/development.pg
username: postgres
password: XXXXXXXX
host: localhost
(replacing XXXXXXXX for my real password, same for test & prod). Then
in a terminal window, in my project directory, I type:
$ sudo jruby -S rake db:create
Error message I get back is:
rake aborted!
Please install the jdbcpostgresql adapter: gem install activerecord-jdbcpostgresql-adapter
(no such file to load –
active_record/connection_adapters/jdbcpostgresql_adapter)
But, I’ve already installed it with:
$ sudo jruby -S gem install jdbc-postgres
activerecord-jdbcpostgresql-adapter
Successfully installed jdbc-postgres-9.1.901
Successfully installed activerecord-jdbcpostgresql-adapter-1.2.2
2 gems installed
I stop webrick, do the install above, restart webrick, rake gives same
error.
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-05-05 20:02:58] INFO WEBrick 1.3.1
[2012-05-05 20:02:58] INFO ruby 1.8.7 (2012-02-22) [java]
[2012-05-05 20:03:03] INFO WEBrick::HTTPServer#start: pid=2089
port=3000
$ jruby -S rake db:create --trace
output is attached to this post.
I know postgresql is running because:
$ sudo /etc/init.d/postgresql stop
- Stopping PostgreSQL 9.1 database server
I can then start it back up with:
$ sudo /etc/init.d/postgresql start
- Starting PostgreSQL 9.1 database server
I’ve also ensured that I uncomment the following line in
/etc/postgresql/9.1/main/postgresql.conf:
listen_addresses = ‘localhost’
After renaming the default rails index.html in the public folder,
creating a controller, and setting up index.html.erb in the views
directory
localhost:3000 in firefox gives me the test page correctly. So I know
this part works.
here’s some extra info. I’m on Ubuntu 12.04, Gnome 3.4,
Which ruby gives:
/usr/bin/ruby
ruby -v gives:
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
jruby -v gives:
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (OpenJDK 64-Bit
Server VM 1.6.0_24) [linux-amd64-java]
java -version gives:
java version “1.6.0_24”
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
irb is working, gives:
irb(main):001:0> puts ((11.to_s * 2).to_i/2)
555
=> nil
irb(main):002:0>
But why is rake not working with postgresql?