What database backends are readily available for Ruby on Rails?
In the introductory tutorials, it talks about MySQL, Postgre and Sqlite3. Is开发者_开发技巧 anything else supported out-of-the-box? Are there any plugins to support other databases?
I'm mainly interested in NoSQL - Cassandra, CouchDB, etc.
Thanks
Activerecord (Rails' default ORM) supports MySQL, Postgres, and sqlite3. If you want to use a different ORM, you have many more choices.
Some links to get you started:
- DataMapper, a popular alternative ORM
- Sequel, another alternative ORM
- Rails wiki article on using CouchDB
- Mongoid, for MongoDB
- MongoMapper, an alternative for MongoDB
I don't have enough experience with Cassandra to mention anything for it. This frontier has not been fully explored.
The game is likely to change some when Rails 3 comes out soon. Expect a lot of choices in this area to sprout up.
Take a look here and here and this last one(for couch). Also - if you're using JRuby - you can use any database that has a JDBC driver - which is just about every database around there.
Ruby on Rails 3 ( still in beta ) is ORM agnostic. So You can change your ORM. Or even you can not use ORM.
So the limitation is in Ruby, not in Ruby on Rails. in futur.
The ActiveModel gem help you with several librarie for compatibility. So you can even made you backend in File or with your own database.
Here we can see on the source code the list of available DBs: https://github.com/rails/rails/tree/b002141b1ba2eef5d192ec31bec5340f7ecca5e9/activerecord/lib/active_record/connection_adapters which as shqdowbq mentions is PostgreSQL, MySQL and SQLite.
https://www.ruby-toolbox.com/categories/Active_Record_DB_Adapters contains a list of third party adapters for other databases, listed options include:
- https://github.com/rails-sqlserver/activerecord-sqlserver-adapter for Microsoft SQL Server
- https://github.com/rsim/oracle-enhanced for Oracle
Related question: List of supported databases?
精彩评论