Search code examples
rubypostgresqljdbcjrubysequel

How to get postgresql to work with sequel and jruby


require 'sequel'
require 'jdbc/postgres'
DB = Sequel.connect("jdbc:postgresql://user:pass@domain/database")
DB.tables

Returns:

....(bla bla bla stack trace bla bla bla)....
Sequel::DatabaseConnectionError: Java::OrgPostgresqlUtil::PSQLException: The connection attempt failed.
...........

I have also tried

jdbc:postgresql://domain/database?user=name&pass=word 

and got an error as well, but a different one('password requested but not provided')

ruby 1.9.3 - jruby 1.7.3

I have looked and looked, tried many code samples, but I am unable to get Sequel working So, How do I get Sequel to interface with postgres while using jruby?


Solution

  • Sequel passes a jdbc connection string directly to JDBC, so there is nothing Sequel-specific about it. You probably want something like jdbc:postgresql://domain/database?user=name&password=secret