PERL + DBD::ODBC/iODBC/freetds -> MSSQL Server 2000
Philip M. Gollucci
pgollucci at ejpress.com
Thu Aug 26 15:23:27 PDT 2004
Hi All,
PLEASE CC pgollucci at ejournalpress.com in the reply my work address is
not subscribed :)
Error Message:
===============
perl db_test.pl "DBI:ODBC:ejp05_pnas" xxxx xxxx
DBI connect('ejp05_pnas','xxxxxx',...) failed: [iODBC][Driver
Manager]Driver's SQLAllocEnv() failed (SQL-IM004)(DBD:
db_login/SQLConnect err=-1) at db_test.pl line 31
at db_test.pl line 22
I am sure that ejp05_pnas is a valid database and my user/name/password
in $ARGV[1], $ARGV[2] are correct. What am I missing. I believe this
error message means I didn't authenticate correct. I can connect to
this database via a System ODBC DSN on Win2k using an MSSQL 2000
connection successfully.
Thanks in advance.
P.S.
I've tried some googling (web and groups), most of this is for php but
applies. Not much actually say how to fix this problem other then to
try different combinations such as DBD-Sybase or unixODBC.
db_test.pl:
============
===-[START]-===
#!/usr/bin/perl -w
use strict;
use warnings FATAL => 'all';
use Carp;
use DBI qw (:sql_types);
my $db_attrs = {
RaiseError => 1,
PrintError => 0,
Taint => 1,
AutoCommit => 0,
ShowErrorStatement => 1,
NAME_lc => 1
};
my $dbh = eval {
DBI->connect($ARGV[0], $ARGV[1], $ARGV[2], $db_attrs);
};
confess $@ if $@;
print "Connected\n";
my $rc = $dbh->disconnect();
confess $rc unless $rc;
print "Disconnected\n";
===-[END]-===
uname:
=======
FreeBSD 5.2.1-RELEASE-p9
Ports:
======
perl5.8.5
p5-DBD-ODBC-1.09/
libiodbc-3.51.2/
freetds-0.62.3/
Configuration files:
====================
/usr/local/etc/libiodbc/iodbc.ini
===-[START]-===
[ODBC]
Debug = Yes
Trace = Yes
DebugFile = /usr/home/philip/bin/odbc-debug.log
TraceFile = /usr/home/philip/bin/odbc-trace.log
TraceAutoStop = 1
[ODBC Data Sources]
ejp05_pnas = my pnas database
[ejp05_pnas]
Driver = /usr/local/lib/libtds.so.3
Description = ejp05_pnas
Host = 192.168.1.5
ServerName = ejp05
ServerType = MSSQL 2000
FetchBufferSize = 99
ReadOnly = no
[Default]
Driver = /usr/local/lib/libtds.so.3
===-[END]-===
/usr/local/etc/freetds.conf
===-[START]-===
[global]
tds version = 4.2
initial block size = 512
swap broken dates = no
swap broken money = no
try server login = yes
try domain login = no
dump file = /usr/home/philip/bin/freetds.log
debug level = 10
[ejp05]
host = 192.168.1.5
port = 1433
tds version = 4.2
===-[END]-===
END
---------------------------------------------------------------------------
eJournalPress
DBA / Software Engineer / System Administrator
E-Mail: pgollucci at ejournalpress.com
URL : http://www.ejournalpress.com
Phone : 301.530.6375
$Id: .signature,v 1.5 2004/08/01 23:46:37 philip Exp $
More information about the freebsd-questions
mailing list