in reply to Confused by DBI:ODBC Driver name
Try using a different string for the stored connection something like this
pojuse 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});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confused by DBI:ODBC Driver name
by Generoso (Prior) on Dec 24, 2011 at 05:03 UTC | |
by karlk123 (Novice) on Dec 27, 2011 at 03:36 UTC |