Skip to Content.
Sympa Menu

freetds - Re: [freetds] Can no longer connect (by tsql or PHP) - "Msg 20004, Read from SQL server failed"?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Can no longer connect (by tsql or PHP) - "Msg 20004, Read from SQL server failed"?
  • Date: Tue, 15 Nov 2005 16:09:17 -0500

> From: Michael Starling
> Sent: Tuesday, November 15, 2005 3:21 PM
> >From: Behalf Of Lowden, James K
> >Sent: Tuesday, November 15, 2005 1:39 PM
> >
> >> [root@www ctt]# tsql -H {domain-name} -p 4000 -U {username}
...
> >> Msg 20004, Level 9, State 0, Server OpenClient, Line 0
> >> -> Read from SQL server failed.
> >
> >I don't think it's the server configuration. Something's up with the
> >network; I suspect the firewall.
>
> He did say it was just "outgoing" on port 4000 he opened up - is
> that the issue? Should it be more than that? (Also - he didn't
> specify, but should it be TCP, UDP, or both? I know my own firewall
> at home has rules like that...).

TDS is a tcp protocol.

> Is it just that one port that needs opening, or are others used
> for 'handshaking' of some sort perhaps? (I know FTP, for example,
> can use various other ones than 21 if in "active" mode...).

You need only one port, and connections are always and only formed by
the client connecting to the server. Unlike FTP, it uses only one
channel: the server does not make an inbound connection.

One of two things is happening:

1. Whatever's answering you on port 4000 isn't Sybase. When you
connect to it, it drops the connection because your login packet tastes
bad.

2. Sybase answers, but something prevents its reponse from reaching
you.

That assumes, as your original message showed, that you're using the TDS
5.0 protocol, which you can verify that with TDSDUMP. Here I try to
connect to my X server (which is listening but doesn't understand TDS!):

$ TDSVER=5.0 TDSDUMP=stdout \
tsql -H localhost -p 6000 -U test -P test 2>/dev/null \
| grep -Ei 'freetds|connect|sending'
15:59:04.377681 Starting log file for FreeTDS 0.63
15:59:04.377989 Connecting to 127.0.0.1 port 6000, TDS 5.0.
15:59:04.382196 Sending packet
15:59:04.383546 Sending packet
15:59:04.384042 goodread: errno=54, "Connection reset by peer"
15:59:04.384094 tds_client_msg: #20004: "Read from SQL server failed.".
15:59:04.384174 leaving tds_process_default_tokens() connection dead
15:59:04.384211 tds_client_msg: #20014: "Login incorrect.".

I think you'll see something similar.

HTH.

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page