My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GettingStarted  
Getting started with ironruby-dbi.
Featured
Updated Feb 4, 2010 by portocar...@gmail.com

Introduction

The DBI implementation for IronRuby has a special connection string to allow specifying a provider to use.

Details

To get started with ironruby-dbi you can reference the documentation of the ruby-dbi project. There is one difference in the way you connect to a database.

In ruby-dbi the connection string to a mssql database would be something like:

DBI.connect('DBI:ADO:data source=(local);initial catalog=MyDatabase;user id=user;password=password')

To connect to the same database but using ADO.NET you would write the following connection string.

DBI.connect('DBI:ADONET:MSSQL:data source=(local);initial catalog=MyDatabase;user id=user;password=password')

There has been an extra colon defined to select the provider that ADO.NET should use to access the database. So instead of just specifying the driver DBI:ADO: which is ADO in this example. You now have to tell DBI that it needs to use the ADO.NET driver with the MSSQL provider DBI:ADONET:MSSQL.

The providers that are installed by default are:

Provider typeProvider nameDescription
ODBCSystem.Data.OdbcConnect to ODBC datasources
OLEDBSystem.Data.OleDbConnect to OleDb datasources like ms access
ORACLESystem.Data.OracleClientConnect to Oracle databases
MSSQLSystem.Data.SqlClientConnect to Microsoft Sql Server databases
SQLCESystem.Data.SqlServerCe.3.5Connect to Microsoft Sql CE databases

I also installed the MySQL .NET connector library and the Sqlite providers so for me the following 2 are also available:

Provider typeProvider nameDescription
MYSQLMySql.Data.MySqlClientConnect to MySql databases
SQLITESystem.Data.SQLiteConnect to Sqlite databases


Sign in to add a comment
Powered by Google Project Hosting