Skip to Content.
Sympa Menu

freetds - Re: [freetds] bypass freetds.conf, tsql works, freetds.conf and php doesn't work

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] bypass freetds.conf, tsql works, freetds.conf and php doesn't work
  • Date: Thu, 14 Jul 2005 14:57:10 -0400

> From: lisa yang
> Sent: Thursday, July 14, 2005 2:17 PM
>
> 1. Works = connected to MS SQL 2000 successfully.
> $ ./tsql -H XXX.XX.XX.XX -p 1433 -U sa
> Password:
> Msg 5703, Level 0, State 1, Server MyMSServer, Line 0
> Changed language setting to us_english.
> 1>
>
> 2. Doesn't work = failed to connect to MS SQL server
> $ ./tsql -S domainName -U sa
> Password:
> src/tds/login.c: tds_connect: XXX.XX.XX.XX:4000: Connection refused
> Msg 20009, Level 9, State 0, Server OpenClient, Line 0
> Server is unavailable or does not exist.
> There was a problem connecting to the server

OK, that's very clear, thanks. This line tells the story:

> src/tds/login.c: tds_connect: XXX.XX.XX.XX:4000: Connection refused

Port 4000 is the compiled-in default for TDS 5.0. The reason FreeTDS is
trying port 4000 is that it's not reading your freetds.conf (or the
[domainName] server section doesn't have a 'port' entry).

Unless you used the --prefix= option to the configure script, FreeTDS
will look for your file in /usr/local/etc/freetds.conf. It will also
check ${HOME}/.freetds.conf (which might help you in testing, but
probably not so good for your PHP server).

You can get a very verbose report of the search for freetds.conf by
setting the TDSDUMPCONFIG environment variable.

> 3. connected to MS SQL successfully if
>
> $ export TDSPORT=1433
> $ ./tsql -S domainName -U sa
> Password:
> Msg 5703, Level 0, State 1, Server MyMSServer, Line 0
> Changed language setting to us_english.

I think the reason this worked is that "nslookup domainName" returns a
valid address. The freetds.conf isn't being used, and you've overridden
the default port with TDSPORT.

HTH.

--jkl


-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information 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