trilogy-libraries / activerecord-trilogy-adapter

Active Record adapter for the Trilogy database client for Rails v6.0 - v7.0.
https://github.com/trilogy-libraries/trilogy
MIT License
167 stars 16 forks source link

Unable to connect to Postgres #41

Closed matthewtusker closed 1 year ago

matthewtusker commented 1 year ago

I'm trying to give trilogy a go to replace our current db config but I seem to be running into issues with the adapter. I'm on Rails 7.0.4 (so I'm using @lorint's PR branch to test against) and changed the adapter in database.yml to trilogy, but can't seem to connect to my Postgres instance.

TrilogyAdapter::Errors::ClosedConnection: Trilogy::QueryError: trilogy_connect - unable to connect to localhost:5432: TRILOGY_CLOSED_CONNECTION

I'm using Postgres@15 via Homebrew, and Ruby 3.1.2. I don't see anything immediately wrong with the setup, and have checked the postgresql adapter, which is working fine.

Any clues I can use to debug this issue?

lorint commented 1 year ago

... can't seem to connect to my Postgres instance

Ah -- this driver is specific to MySQL, so for Postgres the only option is still the pg gem. If there's any snags with that then feel free to get in touch -- I love both the Postgres and MySQL databases, and am always eager to help out.

matthewtusker commented 1 year ago

Ah, I misunderstood when I saw that the Trilogy client was "MySQL-compatible" and had assumed that would mean Postgres also. I actually was hoping it would be compatible with Oracle DB, but I'm guessing that's not actually supported either. Oh well, I guess I'm stuck with InstantClient via Rosetta for a while longer...

lorint commented 1 year ago

was hoping it would be compatible with Oracle DB

You have NO IDEA how much I wish the Oracle Instant Client was compatible with Apple Silicon! The Python folks have created their own native driver for Oracle, and I've considered porting it to Ruby. (But lately I find myself busy with quite a few other things!)

matthewtusker commented 1 year ago

I had noticed that Python driver and was hoping for something similar for Ruby. If I had any idea where to even start building a thin client for Ruby I would give it a go. Dropping InstantClient would make our development environments and our production Docker images much easier to manage.