Skip to Content

I am very happy to announce that SQL Anywhere now has Ruby support! You can take a look at the official project page on RubyForge . Actually, not only is it supported, it is supported three different ways.

The first is a native driver that provides a Ruby interface to the SQL Anywhere C API. This allows Ruby to make simple database requests, and have the results returned as Ruby objects. This provides a relatively low-level interface to SQL Anywhere.

However the driver may be too low-level to provide the simplicity and productivity that Ruby is well-known for. Fortunately, the Ruby community has developed a direct database access layer called Ruby/DBI to make the process of interacting with the database simpler. Ruby/DBI provides a database agnostic interface for interfacing with many databases. Ruby/DBI is based on the popular Perl DBI package.

Lastly, SQL Anywhere supports Ruby’s killer application, Rails . Rails is a full-featured, open source web framework that focuses on rapid development and agile programming techniques. Rails is made up of a series of sub-projects, including one of particular note to us called ActiveRecord . ActiveRecord is a database agnostic, object-relational mapper. For those unfamiliar with ORMs, an ORM package lets an application developer interact only with application-level objects while leveraging the ORM’s capabilities to persist the changes and communicate with the database. Unlike Ruby/DBI, ActiveRecord will write and execute the SQL statements on your behalf as you manipulate application-level objects. There has been a lot of discussion surrounding ORMs recently, and I will add my thoughts in future posts. Suffice to say, ActiveRecord certainly does make using a database look easy.

All of the drivers have been integrated into the Ruby package manager (rubygem ) making them trivial to install. For example, installing the ActiveRecord driver is as simple as typing at the prompt:

gem install activerecord-sqlanywhere-adapter

The project and packages are hosted at RubyForge . The main project page contains links to the documentation and detailed instructions about installing the drivers. All of the drivers are open sourced under that Apache 2 license, and hosted at GitHub . We chose to host the code on GitHub to help enable the communal feedback that is well-known to other Ruby projects. So, if you see something you want to add or fix then I invite you to fork the GitHub repository and go ahead and do it!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply