Skip to Content.
Sympa Menu

freetds - [freetds] FreeTDS 0.60 and MSSQL: Trouble connecting (long)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Alan Murrell <silkbc AT yahoo.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] FreeTDS 0.60 and MSSQL: Trouble connecting (long)
  • Date: Tue, 11 Feb 2003 06:36:10 -0500 (EST)

Hello,

I am attempting to troubleshoot a problem I am having
trying to connect from a Linux web server to a MS SQL
2000 server. Here are the particulars:

Mandrake 9.0
Apache 1.3.26
PHP 4.3.0
FreeTDS 0.60

First, a little background: we have a Customer control
panel, written in PHP, which authenticates users by
connecting to our customer database on the MSSQL 2000
server, and comparing the username/password given with
that in the database. This all works fine on the
current server, which is running FreetDS v0.53 (and
the iodbc libs).

However, we are rebuilding our servers, and I have
installed FreeTDS 0.60 (and iodbc). I used the
following 'configure' options:

--- configure ---
./configure --prefix=/usr/local/freetds
--with-tdsver=4.2 --with-iodbc=/usr/lib
--- configure ---

My 'freetds.conf' (which resides in
'/usr/local/freetds/etc') looks like this:

(Note: IP's changed for security reasons)

--- freetds.conf ---
[global]
tds version = 4.2

[MyServer1]
host = 10.10.170.10
port = 1433
--- freetds.conf ---

However, when I move our site over to the new server,
and test the Control panel, it seems to connect, but
instead of giving me the actual screen after logging
in, I get a failed SQL query message like so:

I have tested with the following simple script:

(Note: IP's, usernames, and passwords changed for
security reasons)

--- db_sybase_connect.php ---
<?php
putenv("TDSDUMP=/tmp/tds.log");
putenv("ODBCINI=/etc/odbc.ini");
putenv("SYBASE=/usr/local/freetds");
putenv("TDSVER=42");

$linkID =
sybase_connect("10.10.170.10","dbusername","dbpassword");

if ($linkID != FALSE)
{
print "The connection to the server was made
successfully.";
}
else
{
print "The connection tot he server failed.";
}

sybase_close($linkID);
?>
--- db_sybase_connect.php ---

When I connect to this script, I get the "successful
connection" message, and to prove it works, I changed
the password, and got the "failed connection" message.
The TDSDUMP file seems to support this. However, the
weird thing is when I run the dame script on the
server where FreeTDS appears to be working, I get the
"failed connection" error ("dump" log indicates that
it is trying to connect on port 4000, even though my
environment variable is definately indocating TDSVER
4.2 ($TDSVER = 42)

I put the 'TDSDUMP' environment variable in the
Control Panel PHP script (on the new server), and have
included it's output below (usernames & passwords
replaced with "x's", and IP's changed where
necessary):

--- tds_dump.log (for control_panel on new server) ---
003-02-11 03:17:16 Connecting addr 10.10.170.10 port
1433
2003-02-11 03:17:16 inside tds_process_login_tokens()
Received header @ 2003-02-11 03:17:16
0000 04 01 01 a4 00 38 01 00
|...¤.8..|


Received packet @ 2003-02-11 03:17:16
0000 e3 17 00 01 04 70 00 6c 00 61 00 74 00 06 6d 00
|ã....p.l. a.t..m.|
0010 61 00 73 00 74 00 65 00 72 00 ab 68 00 45 16 00
|a.s.t.e.r .«h.E..|
0020 00 02 00 23 00 43 00 68 00 61 00 6e 00 67 00 65
|...#.C.h. a.n.g.e|
0030 00 64 00 20 00 64 00 61 00 74 00 61 00 62 00 61
|.d. .d.a. t.a.b.a|
0040 00 73 00 65 00 20 00 63 00 6f 00 6e 00 74 00 65
|.s.e. .c. o.n.t.e|
0050 00 78 00 74 00 20 00 74 00 6f 00 20 00 27 00 70
|.x.t. .t. o. .'.p|
0060 00 6c 00 61 00 74 00 27 00 2e 00 0b 42 00 4f 00
|.l.a.t.'. ...B.O.|
0070 44 00 44 00 49 00 4e 00 47 00 54 00 4f 00 4e 00
|D.D.I.N.G .T.O.N.|
0080 53 00 00 00 00 e3 17 00 02 0a 75 00 73 00 5f 00
|S....ã... .u.s._.|
0090 65 00 6e 00 67 00 6c 00 69 00 73 00 68 00 00 ab
|e.n.g.l.i .s.h..«|
00a0 70 00 47 16 00 00 01 00 27 00 43 00 68 00 61 00
|p.G.....' .C.h.a.|
00b0 6e 00 67 00 65 00 64 00 20 00 6c 00 61 00 6e 00
|n.g.e.d. .l.a.n.|
00c0 67 00 75 00 61 00 67 00 65 00 20 00 73 00 65 00
|g.u.a.g.e . .s.e.|
00d0 74 00 74 00 69 00 6e 00 67 00 20 00 74 00 6f 00
|t.t.i.n.g . .t.o.|
00e0 20 00 75 00 73 00 5f 00 65 00 6e 00 67 00 6c 00
| .u.s._.e .n.g.l.|
00f0 69 00 73 00 68 00 2e 00 0b 42 00 4f 00 44 00 44
|i.s.h.... B.O.D.D|
0100 00 49 00 4e 00 47 00 54 00 4f 00 4e 00 53 00 00
|.I.N.G.T. O.N.S..|
0110 00 00 e3 0f 00 03 05 69 00 73 00 6f 00 5f 00 31
|..ã....i. s.o._.1|
0120 00 01 00 00 e3 0b 00 05 04 31 00 30 00 33 00 33
|....ã.... 1.0.3.3|
0130 00 00 e3 0f 00 06 06 31 00 39 00 36 00 36 00 30
|..ã....1. 9.6.6.0|
0140 00 39 00 00 ad 36 00 01 07 00 00 00 16 4d 00 69
|.9..­6... ....M.i|
0150 00 63 00 72 00 6f 00 73 00 6f 00 66 00 74 00 20
|.c.r.o.s. o.f.t. |
0160 00 53 00 51 00 4c 00 20 00 53 00 65 00 72 00 76
|.S.Q.L. . S.e.r.v|
0170 00 65 00 72 00 00 00 00 00 08 00 02 16 e3 13 00
|.e.r..... ....ã..|
0180 04 04 34 00 30 00 39 00 36 00 04 34 00 30 00 39
|..4.0.9.6 ..4.0.9|
0190 00 36 00 fd 00 00 00 00 00 00 00 00
|.6.ý..... ...|

2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is ab
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is ab
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 increasing block size from 4096 to
4096
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is fd
2003-02-11 03:17:16 leaving tds_process_login_tokens()
returning 1
Sending packet @ 2003-02-11 03:17:16
0000 01 01 00 18 00 00 01 00 75 00 73 00 65 00 20 00
|........u .s.e. .|
0010 70 00 6c 00 61 00 74 00
|p.l.a.t.|


Received header @ 2003-02-11 03:17:16
0000 04 01 00 92 00 38 01 00
|.....8..|


Received packet @ 2003-02-11 03:17:16
0000 e3 13 00 01 04 70 00 6c 00 61 00 74 00 04 70 00
|ã....p.l. a.t..p.|
0010 6c 00 61 00 74 00 ab 68 00 45 16 00 00 01 00 23
|l.a.t.«h. E.....#|
0020 00 43 00 68 00 61 00 6e 00 67 00 65 00 64 00 20
|.C.h.a.n. g.e.d. |
0030 00 64 00 61 00 74 00 61 00 62 00 61 00 73 00 65
|.d.a.t.a. b.a.s.e|
0040 00 20 00 63 00 6f 00 6e 00 74 00 65 00 78 00 74
|. .c.o.n. t.e.x.t|
0050 00 20 00 74 00 6f 00 20 00 27 00 70 00 6c 00 61
|. .t.o. . '.p.l.a|
0060 00 74 00 27 00 2e 00 0b 42 00 4f 00 44 00 44 00
|.t.'....B .O.D.D.|
0070 49 00 4e 00 47 00 54 00 4f 00 4e 00 53 00 00 01
|I.N.G.T.O .N.S...|
0080 00 fd 00 00 e2 00 00 00 00 00
|.ý..â.... .|


2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is e3
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is ab
2003-02-11 03:17:16 inside
tds_process_default_tokens() marker is fd
Sending packet @ 2003-02-11 03:17:16
0000 01 01 00 f4 00 00 01 00 53 00 45 00 4c 00 45 00
|...ô....S .E.L.E.|
0010 43 00 54 00 20 00 69 00 64 00 2c 00 20 00 75 00
|C.T. .i.d .,. .u.|
0020 73 00 65 00 72 00 6e 00 61 00 6d 00 65 00 2c 00
|s.e.r.n.a .m.e.,.|
0030 20 00 6c 00 6f 00 77 00 65 00 72 00 28 00 61 00
| .l.o.w.e .r.(.a.|
0040 63 00 74 00 69 00 76 00 65 00 29 00 20 00 66 00
|c.t.i.v.e .). .f.|
0050 72 00 6f 00 6d 00 20 00 63 00 75 00 73 00 74 00
|r.o.m. .c .u.s.t.|
0060 6f 00 6d 00 65 00 72 00 20 00 77 00 68 00 65 00
|o.m.e.r. .w.h.e.|
0070 72 00 65 00 20 00 6c 00 6f 00 77 00 65 00 72 00
|r.e. .l.o .w.e.r.|
0080 28 00 75 00 73 00 65 00 72 00 6e 00 61 00 6d 00
|(.u.s.e.r .n.a.m.|
0090 65 00 29 00 20 00 3d 00 20 00 6c 00 6f 00 77 00
|e.). .=. .l.o.w.|
00a0 65 00 72 00 28 00 27 00 7a 00 6f 00 6f 00 6c 00
|e.r.(.'.X .X.X.X.|
00b0 69 00 6e 00 6b 00 27 00 29 00 20 00 61 00 6e 00
|X.X.X.'.) . .a.n.|
00c0 64 00 20 00 70 00 61 00 73 00 73 00 77 00 6f 00
|d. .p.a.s .s.w.o.|
00d0 72 00 64 00 20 00 3d 00 20 00 27 00 31 00 32 00
|r.d. .=. .'.X.X.|
00e0 7a 00 6f 00 6f 00 6c 00 69 00 6e 00 6b 00 38 00
|X.X.X.X.X .X.X.X.|
00f0 37 00 27 00
|X.'.|


Received header @ 2003-02-11 03:17:16
0000 04 01 00 4f 00 38 01 00
|...O.8..|


Received packet @ 2003-02-11 03:17:16
0000 81 03 00 00 00 10 00 38 02 69 00 64 00 00 00 09
|.......8. i.d....|
0010 00 a7 64 00 08 75 00 73 00 65 00 72 00 6e 00 61
|.§d..u.s. e.r.n.a|
0020 00 6d 00 65 00 00 00 01 00 a7 01 00 00 d1 29 0f
|.m.e..... §...Ñ).|
0030 00 00 07 00 7a 6f 6f 6c 69 6e 6b 01 00 79 fd 10
|....XXXXX XX..yý.|
0040 00 c1 00 01 00 00 00
|.Á.....|


2003-02-11 03:17:16 inside dbresults()
2003-02-11 03:17:16 processing result tokens. marker
is 81
2003-02-11 03:17:16 processing result tokens. marker
is d1
2003-02-11 03:17:16 leaving dbresults() returning 1
2003-02-11 03:17:16 inside dbnextrow()
2003-02-11 03:17:16 processing row tokens. marker is
d1
2003-02-11 03:17:16 processing row. column is 0
varint size = 0
2003-02-11 03:17:16 processing row. column size is 4
2003-02-11 03:17:16 clearing column 0 NULL bit
2003-02-11 03:17:16 processing row. column is 1
varint size = 2
2003-02-11 03:17:16 processing row. column size is 7
2003-02-11 03:17:16 clearing column 1 NULL bit
2003-02-11 03:17:16 processing row. column is 2
varint size = 2
2003-02-11 03:17:16 processing row. column size is 1
2003-02-11 03:17:16 clearing column 2 NULL bit
2003-02-11 03:17:16 leaving dbnextrow() returning -1
2003-02-11 03:17:16 dbdatlen() type = 56
2003-02-11 03:17:16 leaving dbdatlen() returning 4
2003-02-11 03:17:16 dbdatlen() type = 39
2003-02-11 03:17:16 leaving dbdatlen() returning 7
2003-02-11 03:17:16 dbdatlen() type = 39
2003-02-11 03:17:16 leaving dbdatlen() returning 7
2003-02-11 03:17:16 dbdatlen() type = 39
2003-02-11 03:17:16 leaving dbdatlen() returning 1
2003-02-11 03:17:16 dbdatlen() type = 39
2003-02-11 03:17:16 leaving dbdatlen() returning 1
2003-02-11 03:17:16 inside dbnextrow()
2003-02-11 03:17:16 processing row tokens. marker is
fd
2003-02-11 03:17:16 leaving dbnextrow() returning -2
--- tds_dump.log ---

Hopefully that makes sense to someone? Anyway, I
apologize for the length of my post, but wanted to
make sure you had as much info as possible. Please
let me know if there is any further info I can provide
for you, and I will do what I can.

Oh, I have tried aking TDSVER equal to 7.0 (both
through the TDSVER environment variable, and in the
freetds.conf file, but still no joy)

TIA for your help.

Alan Murrell <silkbc AT yahoo.com>


______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca




Archive powered by MHonArc 2.6.24.

Top of Page