Forum: Ruby on Rails Dynamic database connection

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
903de3fe51f14392609e28e82e1b1c6c?d=identicon&s=25 Rick Fiorentino (rickf)
on 2009-02-25 17:49
Hi All,

Is there a way to determine the adapter type, as well as, other
information on the fly for a database? For example, can you make a
generic type connection to a database (assuming the db server port
and/or credentials are correct) and ask the db information about itself,
then based on the response configure the establish_connection
accordingly? The initial generic connection would not access the actual
data for ROR, but determine the information about the DB for use with
ROR.

One approach is to attempt to access the DB cycling through the
available adapter types until you get a response, however, this seems
clunky at best.

Any thoughts are appreciated.

thanks for any advice,
Rick
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-25 18:00
(Received via mailing list)
On 25 Feb 2009, at 16:49, Rick Fiorentino wrote:

> actual
> data for ROR, but determine the information about the DB for use with
> ROR.
>
> One approach is to attempt to access the DB cycling through the
> available adapter types until you get a response, however, this seems
> clunky at best.
>
You probably could - tools like nmap can probably tell the difference
between mysql running on port x, postgresql running on that same port
etc...
It seems like quite a lot of effort for a onetime setup job though
(unless you're very focussed on that wow it works straight out of the
box experience)

Fred
This topic is locked and can not be replied to.