[Catalyst] Connect Catalyst app to MS SQL Server 2005

Ascii King tech at swattermatter.com
Wed May 27 19:44:02 GMT 2009


I'm trying to connect my Catalyst app to a MS SQL server 2005. I have 
DBIx::Class loaded and I went through the documentation, but I can't 
seem to get the right connection string. Would someone be able to point 
out my mistake and suggest the proper connection string?

Here is the info from my .conf file.

<Model::DB>
    schema_class WebTest::Schema
    <connect_info>
       dsn         dbi:odbc:WebTestODBC
       user        WebGuy
       password   webtest
       AutoCommit   1
    </connect_info>
M/Model::DB>

I have created an ODBC connection called WebTestODBC on the machine 
hosting the MSSQL server.
I have also tried the above with a change to the dsn:
dsn   dbi:MSSQL:WebTestODBC

But I always get the same error:

DBIx::Class::ResultSet::first(): DBI Connection failed: Can't connect to 
data source 'HASH(0x43477e8)' because I can't work out what driver to 
use (it doesn't seem to contain a 'dbi:driver:' prefix and the 
DBI_DRIVER env var is not set) at 
C:/Perl/site/lib/DBIx/Class/Storage/DBI.pm line 839

This suggests that it is not reading the <connect_info> properly and 
instead is looking at the entire thing as a hash. I don't know how to 
get around this. I don't even know if it is the right assumption.

Also, in my \Model\DB.pm I have the following code I took from the 
Catalyst tutorial and modified. I'm not sure if I should just remove it 
or what.

__PACKAGE__->config(
    schema_class => 'WebTest::Schema',
    connect_info => [
          'dbi:odbc:WebTestODBC',
    ],
);



More information about the Catalyst mailing list