Reputation: 2497
I am using tiny_tds for connecting to remote database, which is only used for MySQL and Sql server. Is their is any other gem available which can access any vendor database?
Upvotes: 4
Views: 1736
Reputation: 160551
You're not understanding how database access works.
We use a driver to talk to a database. The database vendors have different protocols that are used to connect, so a driver handles that.
Above that layer we'd have an API that talks to the driver. That'd be something like DBI, which knows how to talk to different drivers. We still have to write using the query language of the database but DBI gives us some advantages. It's a pain to convert from one database to another, because usually all the queries change and the inconsistencies between "standards" show up.
Above that layer we'd have something like ActiveRecord or Sequel, which are ORMs, and are mostly DBM agnostic. They allow us to use a consistent language to define our connections to databases, create queries and handle interactions. If we want to talk to a different database manager, we install the driver, change the connection string, and the rest should work.
This is a huge time savings and a "very good thing". You can use SQLite for your proof-of-concepts, and something like PostgreSQL, MySQL, or Oracle for your production system, without changing queries. Only the DSN/connection string changes usually.
Read through Sequel's "Connecting to a database" document to get an idea what ORMs can do, along with "Sequel: The Database Toolkit for Ruby" and "Cheat Sheet" for an idea what Sequel can do.
Upvotes: 1