On Feb 21, 7:28 pm, beenimble <[email protected]> wrote:
> Sorry for this one, but I've been stuck for the last couple of hours
> trying to connect to Postgres (I just switched over).
>
> I'm trying both my admin and an application-specific account but can't
> connect based on several different variations of the following:
>
> db = Sequel.connect("postgres://user:p...@localhost:5432/mydb")
>
> In all cases I receive the error message "URI::InvalidURIError: bad URI
> (is not URI?)."
>
> I've tried with and without the port number, with my app db and with
> the built-in 'postgres' db, with my app user ('myapp_user') and my
> admin user ('postgres') and different combinations of all these in the
> connect string.
>
> I verified that both accounts can log in using pgAdmin3, the only
> problem seems to be connecting with Sequel.
>
> I installed both the 'pg' (Sequel appears to try this one first) and
> 'postgres' gems, and both are listed among my local gems.
>
> I've moved my testing to irb to hopefully isolate the connection
> problem but receive the same error in the console
> ("URI::InvalidURIError: bad URI(is not URI?)").
>
> At this point and after a bunch of searches I'm not sure what else I
> can try. Does anybody have an idea what I'm missing?
Without a backtrace, I can't help. When I try your connection string,
I get the following:
Sequel::DatabaseConnectionError: PGError FATAL: no pg_hba.conf entry
for host "::1", user "user", database "mydb", SSL off
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/adapters/postgres.rb:197:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/adapters/postgres.rb:197:in `connect'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/adapters/postgres.rb:197:in `connect'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/database.rb:82:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:161:in `call'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:161:in `make_new'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:152:in `available'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:143:in `acquire'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:142:in `synchronize'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:142:in `acquire'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/connection_pool.rb:104:in `hold'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/database.rb:437:in `synchronize'
from /usr/local/lib/ruby/gems/1.8/gems/sequel-2.10.0/lib/
sequel_core/database.rb:459:in `test_connection'
from (irb):2
But that's because that's not a valid user, password, and database
combination on my server (it works with a valid combination).
Also, what version of ruby are your running? Sequel uses the standard
URI class, but I mostly test on 1.8.6, so I'm not sure other ruby
versions handle URIs differently.
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---