[Denver-pm] Perl -> SQL Server
Robert L. Harris
robert.l.harris at gmail.com
Tue Jun 24 14:44:28 PDT 2014
Delving into a new area... Have to pull data from a SQL db and I'm getting
an error.
DBI connect('Driver={ODBC Driver 11 for SQL Server}, Server=10.241.4.64,
UID=ReadOnlyUser, PWD=MyPasswd','',...) failed: [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
(SQL-IM002) at /usr/local/bin/EDW_Pull.pl line 97.
Uncaught exception from user code:
Couldn't connect to Database: [unixODBC][Driver Manager]Data source
name not found, and no default driver specified (SQL-IM002) at
/usr/local/bin/EDW_Pull.pl line 97.
at /usr/local/bin/EDW_Pull.pl line 97.
main::Create_DB_Connection called at /usr/local/bin/EDW_Pull.pl
line 20
I am able to connect with sqsh:
/usr/local/sqsh/bin/sqsh -S10.241.4.64 -U ReadOnlyUser -PMyPasswd
I can also use -SSIT from the .ini below with sqsh.
Perl Connection String:
my $dsn="dbi:ODBC:Driver={ODBC Driver 11 for SQL Server}";
$dbh =DBI->connect( "$dsn, Server=$Host, UID=$dbuser, PWD=$dbpasswd" ) ||
die "Couldn't connect to Database: " . DBI->errstr;
I get the same error if I use:
my $dsn="dbi:ODBC:Driver={FreeTDS}";
my $dsn="dbi:ODBC:SIT";
my $dsn="dbi:ODBC:10.241.4.64";
Configs:
/etc/freetds.conf
[SIT]
host = 10.241.4.64
port = 1433
tds version = 8.0
/etc/odbc.ini
[SIT]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = 10.241.4.64
Database = Landing
and /etc/odbcinst.ini
[ODBC Driver 11 for SQL Server]
Description=Microsoft ODBC Driver 11 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0
Threading=1
UsageCount=2
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib64/libtdsodbc.so.0
CPTimeout =
CPReuse =
FileUsage = 1
--
:wq!
---------------------------------------------------------------------------
Robert L. Harris
DISCLAIMER:
These are MY OPINIONS With Dreams To Be A King,
ALONE. I speak for First One Should Be A Man
no-one else. - Manowar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/denver-pm/attachments/20140624/8cce6299/attachment.html>
More information about the Denver-pm
mailing list