On Wednesday, May 27, 2020 at 9:39:33 AM UTC-7, Tiago Cardoso wrote:
>
> I still think the problem is in sequel. What 
> sequel-activerecord_connection does is:
>
> * Initiates a sequel database object via Sequel.connect with test: false, 
> to not initiate a db connection itself.
> * loads the activerecord_connection extension, which injects the 
> plugin-specific methods.
>
> I'm trying to get the first step working, which is all sequel. Here's how 
> it went for me:
>
> 1. Sequel.connect(adapter: "postgresql", test: false)
>
> Sequel::AdapterNotFound (LoadError: no such file to load -- pg)
>
> sequel doesn't try to automatically use jdbc in jruby, so it tries to load 
> an adapter which can't be used in jruby.
>

Sequel falls back to also trying to load postgres-pr, which does work fine 
in JRuby. I maintain jeremyevans-postgres-pr which is a fork with greater 
Sequel compatibility and various bug fixes, and regularly test this on 
JRuby.
 

> 2. Sequel.connect(adapter: "jdbc:postgresql", test: false)
>
> Sequel::AdapterNotFound (LoadError: no such file to load -- 
> sequel/adapters/jdbc:postgresql)
>
> Although I'm using a similar way of declaring the adapter as the one for 
> the full URI, jdbc isn't properly inferred here, and the file lookup 
> obviously fails.
>
> 3.  Sequel.connect(adapter: "jdbc/postgresql", test: false)
>
> NameError (uninitialized constant Sequel::JDBC)
>
> I tried to work on the previous one by declaring the subpath, so the file 
> was required (good) but the constant doesn't exist (bad), which probably 
> means that the jdbc adapter has to be loaded first.
>
> 4. Sequel.connect(adapter: "jdbc", test: false)
>
> => #<Sequel::JDBC::Database: "jdbc:" {:adapter=>"jdbc", :test=>false}>
>
> this one actually works... however, it doesn't load the jdbc 
> postgresql-specific code that I need, and then all of those errors I 
> reported in the beginning start happening.
>

If you must use a hash:

  Sequel.connect(adapter: :jdbc, uri: "jdbc:postgresql://...")
 

> In order for sequel-activerecord_connection to work for jruby, sequel must 
> allow to create a database object with the db-specific extensions and which 
> doesn't initiate a db connection; just like it's doing for the other 
> non-jruby adapters. IMO one of 1, 2, 3 must work in order for me to 
> accomplish this. Or is there another way of doing this for which I didn't 
> find documentation?
>

I'm not sure why it cannot use just the plain connection string:

  Sequel.connect("jdbc:postgresql://...")

or the Sequel.jdbc method that is also described in the Connecting to a 
Database guide:

  Sequel.jdbc("jdbc:postgresql://localhost/sequel_test?user=sequel_test", 
test: false)

However, you could try the hash-based approach I gave above.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/c29c631f-aefb-46e3-9c63-5adda4e4a35a%40googlegroups.com.

Reply via email to