in reply to Confused by DBI:ODBC Driver name

Try using a different string for the stored connection something like this

use strict; use DBI; print "Driver = $_\n" for DBI->data_sources('ODBC'); my $db_name = 'online_labs_gs'; my $db_type = 'MSSQL'; my %SERVER = ( MSSQL => { 'dsn' => 'DBI:ODBC:MS SQL 2005', 'user' => 'yyy', 'pwd' => 'yyy', }, MSSQL1 => { 'dsn' => "DBI:ODBC:driver={SQL Server};server=localhost;dbq=$db_n +ame", 'user' => 'yyy', 'pwd' => 'yyy', }, MySQL => { 'dsn' => "dbi:mysql:$db_name:localhost:3306", 'user' => 'xxx', 'pwd' => 'xxx', }, ); my $hr = $SERVER{$db_type}; my $dbh = DBI->connect($hr->{'dsn'},$hr->{'user'},$hr->{'pwd'}, {RaiseError => 1});
poj

Replies are listed 'Best First'.
Re^2: Confused by DBI:ODBC Driver name
by Generoso (Prior) on Dec 24, 2011 at 05:03 UTC

    Have you tested your DSN? Does it connect to the database?

      Yes I have. Using {SQL Server}, I can connect to the database and access things. I just wonder if the SQL Server driver manages to somehow make a connection by some knowledge it has of the system. So far, things work just fine using it vs. what I expect to use as the DSN on a local machine. It might be different connecting to remote server, but I haven't done that yet.