[Dbix-class] Can't get MSSQL connected

Alan Humphrey alan.humphrey at comcast.net
Fri Jan 28 20:19:49 GMT 2011


> -----Original Message-----
> From: Oleg Kostyuk [mailto:cub.uanic at gmail.com]
> Sent: Friday, January 28, 2011 11:37 AM
> To: DBIx::Class user and developer list
> Subject: [Dbix-class] Can't get MSSQL connected
> 
> Hello guys,
> 
> Please help.
> I have catalyst app + dbic schema, all working fine with sqlite.
> I'm trying to change dsn and connect to mssql, and can't get it
> working.
> username/pass is correct - I checked via rdp connection with native
> mssql server console.
> All needed things is installed as described inDBIx::Class::Storage:
> :DBI::ODBC::Microsoft_SQL_Server.
> What could be problem?....
> 
> DBIC version is 0.08127
> 
> Connection config:
> 
> <Model::DB::HeadOffice>
>     <connect_info>
>         # SQLite working just fine
>         # dsn         dbi:SQLite:__path_to(tmp/herbal-
> headoffice.sqlite.db)__
>         dsn
> dbi:ODBC:server=192.168.0.102;driver=FreeTDS;tds_version=8.0;database=h
> eadoffice
>         user        sa
>         password    qqqqq
>     </connect_info>
> </Model::DB::HeadOffice>
> 
> Please see http://paste.scsys.co.uk/85491 for server log messages.
> 
> Thanks in advance!
> 

Not sure what your specific problem is, but here's what I use to connect to MSSQL via FreeTDS.

In my app_name.yml file:

connect_info:
dsn: 'DBI:Sybase:server=myservername;database=mydatabasename
user: username
pass: password

in my freetds.conf file:

[myservername]
    host = myhost
    port = 1433
    tds version = 8.0

where 'myservername' in the dsn refers to the 'myservername' entry in the freetds.conf file.

I recommend using the tsql commandline tool to make sure you've got Freetds configured correctly, then figure out the Catalyst/DBIx::Class end of things.

- Alan




More information about the DBIx-Class mailing list