Rails and SQL Server 2005 Express

Hi,

A Rails app can connect to SQL Server 2005 Express. The main issue of which to be aware, though, is that Express installs as a named instance by default. Therefore, in your database.yml file, you must provide both the server name (your machine name) and the named instance (SQLEXPRESS by default). For example:

test: adapter: sqlserver mode: ado database: sql2k5_spike_test username: user password: pwd host: DBI:ADO:Provider=SQLOLEDB;Data Source=MACHINE_NAME\SQLEXPRESS;

Note that I had to use uppercase for the machine\instance. Furthermore, neither localhost (uppercase or lowercase) nor 127.0.0.1 would suffice in place of my machine name. This is unfortunate if multiple people will be working on the project, as each of their machine names will be unique.

Therefore, you should consider installing Express as a default (unnamed) instance. If you’ve already installed as a named instance, you’ll have to reinstall as a default instance. Then you can just use localhost in place of machine\instance for development and test.

test: adapter: sqlserver mode: ado database: sql2k5_spike_test username: user password: pwd host: DBI:ADO:Provider=SQLOLEDB;Data Source=localhost;

Almost forgot… I did all of this on Windows XP Pro, as I don’t have access to Vista. You’ll just have to give it a try and let us know how it goes. :slight_smile:

Regards, Craig