Skip to Content.
Sympa Menu

freetds - [freetds] DBI connect('Test',...) failed: (no error string)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Jeff Williams" <Jeff.Williams AT infospace.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] DBI connect('Test',...) failed: (no error string)
  • Date: Fri, 17 Oct 2008 17:24:34 -0000

Hello,



I am having a problem successfully connecting to a SQL Server using
perl->DBI::ODBC->unixODBC->FreeTDS flow. The SQL server sees that a
successful connection is made, but the perl program returns



DBI connect('Test',...) failed: (no error string)



As you can see from the script output below there is a point where
"SQLDriverConnect failed" But I can't find a corresponding error in the
FreeTDS log. Am I missing something?



This is the perl script:



#!/usr/bin/perl -w

use DBI;

DBI->trace(15);

my $dbh = DBI->connect("DBI:ODBC:Test" ,'####','####)|| die "Database
connection not made: $DBI::errstr";



This is the script output:

dwuprcron1n:/export/home/stats/mods/freetds-0.82 #
/export/home/stats/connect_test.pl

DBI 1.607-ithread default trace level set to 0x0/15 (pid 1870) at
connect_test.pl line 3

-> DBI->connect(DBI:ODBC:Test, ####, ****)

-> DBI->install_driver(ODBC) for linux perl=5.008003 pid=1870 ruid=0
euid=0

install_driver: DBD::ODBC version 1.17 loaded from
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBD/ODBC.pm

New 'DBI::dr' (for DBD::ODBC::dr, parent='', id=undef)

dbih_setup_handle(DBI::dr=HASH(0x82cce88)=>DBI::dr=HASH(0x82ccedc),
DBD::ODBC::dr, 0, Null!)

dbih_make_com(Null!, 0, DBD::ODBC::dr, 92, 0) thr#814f008

dbih_setup_attrib(DBI::dr=HASH(0x82ccedc), Err, Null!)
SCALAR(0x820aabc) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0x82ccedc), State, Null!)
SCALAR(0x820ab04) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0x82ccedc), Errstr, Null!)
SCALAR(0x820aae0) (already defined)

dbih_setup_attrib(DBI::dr=HASH(0x82ccedc), TraceLevel, Null!) 0
(already defined)

dbih_setup_attrib(DBI::dr=HASH(0x82ccedc), FetchHashKeyName, Null!)
'NAME' (already defined)

<- install_driver= DBI::dr=HASH(0x82cce88)

>> connect DISPATCH (DBI::dr=HASH(0x82cce88) rc2/3 @5 g0 ima8001
pid#1870) at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 638

!! warn: 0 CLEARED by call to connect method

-> connect for DBD::ODBC::dr (DBI::dr=HASH(0x82cce88)~0x82ccedc
'Test' '####' **** HASH(0x821c010)) thr#814f008

New 'DBI::db' (for DBD::ODBC::db, parent=DBI::dr=HASH(0x82ccedc),
id=undef)

dbih_setup_handle(DBI::db=HASH(0x82cdaa8)=>DBI::db=HASH(0x82cda24),
DBD::ODBC::db, 8257b48, Null!)

dbih_make_com(DBI::dr=HASH(0x82ccedc), 81eac90, DBD::ODBC::db, 340,
0) thr#814f008

dbih_setup_attrib(DBI::db=HASH(0x82cda24), Err,
DBI::dr=HASH(0x82ccedc)) SCALAR(0x8257cec) (already defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), State,
DBI::dr=HASH(0x82ccedc)) SCALAR(0x8257d4c) (already defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), Errstr,
DBI::dr=HASH(0x82ccedc)) SCALAR(0x8257d1c) (already defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), TraceLevel,
DBI::dr=HASH(0x82ccedc)) 0 (already defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), FetchHashKeyName,
DBI::dr=HASH(0x82ccedc)) 'NAME' (already defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), HandleSetErr,
DBI::dr=HASH(0x82ccedc)) undef (not defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), HandleError,
DBI::dr=HASH(0x82ccedc)) undef (not defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), ReadOnly,
DBI::dr=HASH(0x82ccedc)) undef (not defined)

dbih_setup_attrib(DBI::db=HASH(0x82cda24), Profile,
DBI::dr=HASH(0x82ccedc)) undef (not defined)

SQLDriverConnect failed:

!!dbd_error2(err_rc=-2,
what=post_connect/SQLSetConnectAttr(SQL_AUTOCOMMIT),
handles=(82ce708,82cec98,0)

>> DESTROY DISPATCH (DBI::db=HASH(0x82cdaa8) rc1/1 @1 g0
ima10004 pid#1870) at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 638

<> DESTROY(DBI::db=HASH(0x82cdaa8)) ignored for outer handle (inner
DBI::db=HASH(0x82cda24) has ref cnt 1)

>> DESTROY DISPATCH (DBI::db=HASH(0x82cda24) rc1/1 @1 g0
ima10004 pid#1870) at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 638

-> DESTROY for DBD::ODBC::db (DBI::db=HASH(0x82cda24)~INNER)
thr#814f008

DESTROY for DBI::db=HASH(0x82cda24) ignored - handle not
initialised

<- DESTROY= undef at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 638

DESTROY (dbih_clearcom) (dbh 0x82cda24, com 0x82cdde0, imp
DBD::ODBC::db):

FLAGS 0x100011: COMSET Warn PrintWarn

PARENT DBI::dr=HASH(0x82ccedc)

KIDS 0 (0 Active)

dbih_clearcom 0x82cda24 (com 0x82cdde0, type 2) done.



<- connect= undef at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 638

-> $DBI::errstr (&) FETCH from lasth=HASH

>> DBD::ODBC::dr::errstr

<- $DBI::errstr= undef

DBI connect('Test','####',...) failed: (no error string)

DBI connect('Test','####',...) failed: (no error string) at
/export/home/stats/connect_test.pl line 4

-> $DBI::errstr (&) FETCH from lasth=HASH

>> DBD::ODBC::dr::errstr

<- $DBI::errstr= undef

Use of uninitialized value in concatenation (.) or string at
/export/home/stats/connect_test.pl line 4.

Database connection not made: at /export/home/stats/connect_test.pl
line 4.

-- DBI::END ($@: , $!: )

>> disconnect_all DISPATCH (DBI::dr=HASH(0x82cce88) rc1/3 @1 g0
ima801 pid#1870) at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 717 v

ia at /export/home/stats/connect_test.pl line 0

-> disconnect_all for DBD::ODBC::dr
(DBI::dr=HASH(0x82cce88)~0x82ccedc) thr#814f008

<- disconnect_all= '' at
/usr/lib/perl5/site_perl/5.8.3/i586-linux-thread-multi/DBI.pm line 717
via at /export/home/stats/connect_test.pl line 0

! >> DESTROY DISPATCH (DBI::dr=HASH(0x82cce88) rc1/1 @1 g0
ima10004 pid#1870) during global destruction

! <> DESTROY(DBI::dr=HASH(0x82cce88)) ignored for outer handle (inner
DBI::dr=HASH(0x82ccedc) has ref cnt 1)

! >> DESTROY DISPATCH (DBI::dr=HASH(0x82ccedc) rc1/1 @1 g0
ima10004 pid#1870) during global destruction

! -> DESTROY in DBD::_::common for DBD::ODBC::dr
(DBI::dr=HASH(0x82ccedc)~INNER) thr#814f008

! <- DESTROY= undef during global destruction

DESTROY (dbih_clearcom) (drh 0x82ccedc, com 0x81eac90, imp global
destruction):

FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit

PARENT undef

KIDS 0 (0 Active)

dbih_clearcom 0x82ccedc (com 0x81eac90, type 1) done.





This is the TDSDUMP log:



log.c:190:Starting log file for FreeTDS 0.82

on 2008-10-17 11:20:56 with debug flags 0x4fff.

iconv.c:197:names for ISO-8859-1: ISO-8859-1

iconv.c:197:names for UTF-8: UTF-8

iconv.c:197:names for UCS-2LE: UCS-2LE

iconv.c:197:names for UCS-2BE: UCS-2BE

iconv.c:363:iconv to convert client-side data to the "ISO-8859-1"
charact

iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"

net.c:210:Connecting to 10.149.63.176 port 5176 (TDS version 4.2)

net.c:264:tds_open_socket: connect(2) returned "Operation now in
progress

net.c:303:tds_open_socket() succeeded

util.c:162:Changed query state from DEAD to IDLE

net.c:779:Sending packet

0000 02 00 02 00 00 00 00 00-64 77 75 70 72 63 72 6f |........ dwuprcro|

0010 6e 31 6e 00 00 00 00 00-00 00 00 00 00 00 00 00 |n1n..... ........|

0020 00 00 00 00 00 00 0b 69-64 73 73 5f 65 74 6c 00 |.......i dss_etl.|

0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0040 00 00 00 00 00 08 38 64-73 73 5f 33 35 6c 00 00 |......8d ss_35l..|

0050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0060 00 00 00 00 08 33 37 38-37 36 00 00 00 00 00 00 |.....378 76......|

0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0080 00 00 00 05 03 01 06 0a-09 01 00 00 00 00 02 00 |........ ........|

0090 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

00a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

00b0 00 00 00 53 52 43 48 56-53 51 4c 50 52 32 4e 00 |...SRCHV SQLPR2N.|

00c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

00d0 00 0c 38 64 73 73 5f 33-35 6c 00 00 00 00 00 00 |..8dss_3 5l......|

00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

01a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

01b0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

01c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

01d0 00 08 04 02 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|

01e0 00 00 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|

01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|



net.c:779:Sending packet

0000 02 01 00 4c 00 00 00 00-00 00 00 00 00 00 0a 00 |...L.... ........|

0010 00 00 00 00 00 00 00 00-00 00 00 00 00 69 73 6f |........ .....iso|

0020 5f 31 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |_1...... ........|

0030 00 00 00 00 00 00 00 00-00 00 00 05 01 35 31 32 |........ .....512|

0040 00 00 00 03 00 00 00 00-00 00 00 00 |........ ....|



token.c:312:tds_process_login_tokens()

net.c:592:Received header

0000 04 01 00 a9 00 35 01 00- |.....5..|



net.c:671:Received packet

0000 e3 0f 00 01 06 6d 61 73-74 65 72 06 6d 61 73 74 |.....mas ter.mast|

0010 65 72 ab 47 00 45 16 00-00 02 00 25 00 43 68 61 |er.G.E.. ...%.Cha|

0020 6e 67 65 64 20 64 61 74-61 62 61 73 65 20 63 6f |nged dat abase co|

0030 6e 74 65 78 74 20 74 6f-20 27 6d 61 73 74 65 72 |ntext to 'master|

0040 27 2e 16 53 52 43 48 56-53 51 4c 50 52 32 4e 5c |'..SRCHV SQLPR2N\|

0050 53 52 43 48 53 51 4c 32-4e 00 00 00 e3 09 00 03 |SRCHSQL2 N.......|

0060 05 69 73 6f 5f 31 01 00-ad 20 00 01 04 02 00 00 |.iso_1.. . ......|

0070 16 4d 69 63 72 6f 73 6f-66 74 20 53 51 4c 20 53 |.Microso ft SQL S|

0080 65 72 76 65 72 00 00 5f-08 00 ff e3 0a 00 04 03 |erver.._ ........|

0090 35 31 32 04 34 30 39 36-fd 00 00 00 00 00 00 00 |512.4096 ........|

00a0 00 - |.|



token.c:316:looking for login token, got e3(ENVCHANGE)

token.c:108:tds_process_default_tokens() marker is e3(ENVCHANGE)

token.c:316:looking for login token, got ab(INFO)

token.c:108:tds_process_default_tokens() marker is ab(INFO)

token.c:2451:tds_process_msg() reading message from server

token.c:2516:tds_process_msg() calling client msg handler

odbc.c:2032:msgno 5701 20003

token.c:2529:tds_process_msg() returning TDS_SUCCEED

token.c:316:looking for login token, got e3(ENVCHANGE)

token.c:108:tds_process_default_tokens() marker is e3(ENVCHANGE)

token.c:2356:server indicated charset change to "iso_1"

iconv.c:985:setting server single-byte charset to "ISO-8859-1"

token.c:316:looking for login token, got ad(LOGINACK)

token.c:316:looking for login token, got e3(ENVCHANGE)

token.c:108:tds_process_default_tokens() marker is e3(ENVCHANGE)

token.c:316:looking for login token, got fd(DONE)

token.c:108:tds_process_default_tokens() marker is fd(DONE)

token.c:2201:tds_process_end: more_results = 0

was_cancelled = 0

error = 0

done_count_valid = 0

token.c:2217:tds_process_end() state set to TDS_IDLE

token.c:2232: rows_affected = 0

token.c:393:leaving tds_process_login_tokens() returning 1

mem.c:563:tds_free_all_results()

util.c:162:Changed query state from IDLE to QUERYING

util.c:162:Changed query state from QUERYING to PENDING

net.c:779:Sending packet

0000 01 01 00 15 00 00 00 00-75 73 65 20 4b 65 76 69 |........ use Kevi|

0010 6e 54 65 73 74 - |nTest|



token.c:495:tds_process_tokens(0x82e3b78, 0xbfffd8b4, 0xbfffd8b8, 0x100)

util.c:162:Changed query state from PENDING to READING

net.c:592:Received header

0000 04 01 00 73 00 35 01 00- |...s.5..|



net.c:671:Received packet

0000 e3 12 00 01 09 4b 65 76-69 6e 54 65 73 74 06 6d |.....Kev inTest.m|

0010 61 73 74 65 72 ab 4a 00-45 16 00 00 01 00 28 00 |aster.J. E.....(.|

0020 43 68 61 6e 67 65 64 20-64 61 74 61 62 61 73 65 |Changed database|

0030 20 63 6f 6e 74 65 78 74-20 74 6f 20 27 4b 65 76 | context to 'Kev|

0040 69 6e 54 65 73 74 27 2e-16 53 52 43 48 56 53 51 |inTest'. .SRCHVSQ|

0050 4c 50 52 32 4e 5c 53 52-43 48 53 51 4c 32 4e 00 |LPR2N\SR CHSQL2N.|

0060 01 00 fd 00 00 e2 00 00-00 00 00 |........ ...|



token.c:510:processing result tokens. marker is e3(ENVCHANGE)

token.c:108:tds_process_default_tokens() marker is e3(ENVCHANGE)

token.c:510:processing result tokens. marker is ab(INFO)

token.c:108:tds_process_default_tokens() marker is ab(INFO)

token.c:2451:tds_process_msg() reading message from server

token.c:2516:tds_process_msg() calling client msg handler

odbc.c:2032:msgno 5701 20003

token.c:2529:tds_process_msg() returning TDS_SUCCEED

token.c:510:processing result tokens. marker is fd(DONE)

token.c:2201:tds_process_end: more_results = 0

was_cancelled = 0

error = 0

done_count_valid = 0

token.c:2217:tds_process_end() state set to TDS_IDLE

util.c:162:Changed query state from READING to IDLE

token.c:2232: rows_affected = 0

util.c:110:logic error: cannot change query state from IDLE to PENDING

token.c:495:tds_process_tokens(0x82e3b78, 0xbfffd8b4, 0xbfffd8b8, 0x100)

token.c:498:tds_process_tokens() state is COMPLETED

odbc.c:4672:SQLGetFunctions: fFunction is 999

odbc.c:5587:SQLGetInfo(0x82e2970, 77, 0xbfffd970, 20, (nil))

odbc.c:4841:_SQLGetInfo(0x82e2970, 77, 0xbfffd970, 20, (nil)

odbc.c:5587:SQLGetInfo(0x82e2970, 10000, 0xbfffd970, 5, (nil))

odbc.c:4841:_SQLGetInfo(0x82e2970, 10000, 0xbfffd970, 5, (nil)

odbc.c:5909:SQLSetConnectAttr(0x82cec98, 102, 0x1, 0)

odbc.c:3680:SQLFreeHandle(2, 0x0x82cec98)

odbc.c:3680:SQLFreeHandle(1, 0x0x82ce708)



My .odbc.ini



[Test]

Driver = /usr/local/freetds/lib/libtdsodbc.so

Description = test

Driver = FreeTDS

Servername = SRCHVSQLPR2N

Database = KevinTest

UID = idss_etl

PWD = 8dss_35l

Port = 5176



My odbcinst.ini



[FreeTDS]

Description = FreeTDS unixODBC Driver

Driver = /usr/local/freetds/lib/libtdsodbc.so.0

Setup = /usr/local/freetds/lib/libtdsodbc.so.0

FileUsage = 1

Trace = Yes

TraceFile = /tmp/sql.log

ForceTrace = Yes



My freetds.conf



# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $

#

# This file is installed by FreeTDS if no file by the same

# name is found in the installation directory.

#

# For information about the layout of this file and its settings,

# see the freetds.conf manpage "man freetds.conf".



# Global settings are overridden by those in a database

# server specific section

[global]

tds version = 8.0

debug level = 10

text size = 64512



[SRCHVSQLPR2N]

host = SRCHVSQLPR2N.inspinc.ad

port = 5176

tds version = 4.2











Thanks,



Jeff Williams

Unix Administrator

Infospace, Inc.








  • [freetds] DBI connect('Test',...) failed: (no error string), Jeff Williams, 10/17/2008

Archive powered by MHonArc 2.6.24.

Top of Page