$ENV{DBI_DSN} = 'dbi:ODBC:SQL Server';
$ENV{DBI_USER} = 'JohnSmith';
$ENV{DBI_PASS}='Hello';
####
------------
>odbcinst --version
unixODBC 2.2.11
-------
>perl -MDBI -e 'DBI-> installed_versions;'
Perl : 5.008008 (i386-linux-thread-multi) -> I really have 5.8.8
OS : linux (2.6.9-42.0.3.elsmp)
DBI : 1.604
DBD::Sponge : 12.010002
DBD::Proxy : 0.2004
DBD::ODBC : 1.15
DBD::Gofer : 0.010103
DBD::File : 0.35
DBD::ExampleP : 12.010007
DBD::DBM : 0.03
>odbcinst -j
unixODBC 2.2.11
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini
>odbcinst -q -d
[SQL Server]
[PostgreSQL]
##
##
----------------------- Paste code example 1
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::ODBC;
my $DSN = 'driver={SQL Server};Server=Server05;database=Payroll;uid=JohnSmith;'
my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n";
---------------------- End Paste code example 1
##
##
---------------------- Paste error message example 1
DBI connect('driver={SQL Server};Server=Fridge;database=Payroll;uid=JohnSmith;','',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at a1.pl line 9
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
---------------------- End Paste error message example 1
##
##
----------------------- Paste code example 2
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::ODBC;
my $DSN = 'driver={SQL Server};Server=10.0.0.53:1433;Database=Payroll;Uid=JohnSmith;Pwd=Hello;';
my $dbh = DBI->connect("dbi:ODBC:$DSN") or die ($DBI::errstr . "\n");
---------------------- End Paste code example 2
##
##
---------------------- Paste error message example 2
DBI connect('driver={SQL Server};Server=10.0.0.53:1433;Database=Payroll;Uid=JohnSmith;Pwd=Hello;','',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at aa.pl line 6
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
---------------------- Paste error message example 2