Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 565
Shelvacu Avatar asked Oct 17 '25 07:10

Shelvacu


1 Answers

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

like image 130
Jeremy Evans Avatar answered Oct 20 '25 00:10

Jeremy Evans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!