Skip to Content.
Sympa Menu

freetds - RE: [freetds] Re: connecting to remote MS Sql 2k server from linux PHP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Rick D. Conner" <rick AT wedosites.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Re: connecting to remote MS Sql 2k server from linux PHP
  • Date: Mon, 1 Nov 2004 10:50:34 -0500

Ok, I did add an entry to the .freetds.conf file named [SYBASE] and set it
up and it now finds it and finds the right ip etc... But it still doesn't
connect. I get the following in tds.log.txt:

Starting log file for FreeTDS 0.62.3
on 2004-11-01 10:45:02 with debug level 99.
iconv to convert client-side data to the "ISO-8859-1" character set
10:45:02.516082 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
10:45:02.516113 Connecting to 66.208.184.170 port 1433, TDS 4.2.
10:45:07.511429 tds_client_msg: #20009: "Server is unavailable or does not
exist.". Connection state is now 0.

So I guess what I need to know now, is what are the "network" items that
need checked and any settings to ensure is setup at both ends. I've got the
port opened on the router, and the webhost said they did the same. The
documentation doesn't include much about this at all, and I don't have
command line access...

Rick D. Conner
Rick AT WeDoSites.com
http://www.wedosites.com


-----Original Message-----
From: Rick D. Conner [mailto:rick AT wedosites.com]
Sent: Monday, November 01, 2004 10:24 AM
To: 'FreeTDS Development Group'
Subject: RE: [freetds] Re: connecting to remote MS Sql 2k server from linux
PHP

If I setup an entry in the config file for "SYBASE" and had it set to my
default server would that help?


Rick D. Conner
Rick AT WeDoSites.com
http://www.wedosites.com

-----Original Message-----
From: Rick D. Conner [mailto:rick AT wedosites.com]
Sent: Friday, October 29, 2004 12:01 AM
To: 'FreeTDS Development Group'
Subject: RE: [freetds] Re: connecting to remote MS Sql 2k server from linux
PHP

Thanks for the response...

Ok to start off, it is running under apache, not the command line.

/home/bwelch/.freetds.conf
=========================================

[global]
# TDS protocol version
tds version = 4.2

; initial block size = 512

# uses some fixes required for some bugged MSSQL 7.0 server that
# return invalid data to big endian clients
# NOTE TDS version 7.0 or 8.0 should be used instead
; swap broken dates = no
; swap broken money = no

# Database server login method, if both server and domain
# logins are enabled, domain login is tried first if a domain
# is specified, and if that fails the server login will be used.
# OBSOLETE
; try server login = yes
; try domain login = no

# The default authentication domain, can be overridden by
# specifying a username with a domain prefix, e.g. DOMAIN\username
# OBSOLETE use DOMAIN\username as username
; nt domain = WORKGROUP

# If the server responds with different domain try that one?
# OBSOLETE never been used
; cross domain login = no

# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug level = 10

# Command and connection timeouts
; timeout = 10
; connect timeout = 10

# If you get out of memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# (Microsoft servers sometimes pretend TEXT columns are
# 4 GB wide!) If you have this problem, try setting
# 'text size' to a more reasonable limit
text size = 64512

# This is a Sybase hosted database server, if you are directly on the
# net you can use it to test.
[JDBC]
host = 192.138.151.39
port = 4444
tds version = 5.0

# The same server, using TDS 4.2. Used in configuration examples for the
# pool server, since the pool server supports only TDS 4.2.
[JDBC_42]
host = 192.138.151.39
port = 4444
tds version = 4.2

# The client connecting to the pool server will use this to find its
# listening socket. This entry assumes that the client is on the same
# system as the pool server.
[mypool]
host = 127.0.0.1
port = 5000
tds version = 4.2

# A typical Microsoft SQL Server 2000 configuration
[MyServer2k]
host = 66.208.184.170
port = 1433
tds version = 4.2
dump file = /home/bwelch/public_html/test/tds.log.txt


==========================================



I have noticed also that it "sees" the MyServer2k entry, but doesn't seem to
use it. I'm all confused :(



Rick D. Conner
Rick AT WeDoSites.com
http://www.wedosites.com

-----Original Message-----
From: Daniel Fazekas [mailto:fdsubs AT axelero.hu]
Sent: Thursday, October 28, 2004 7:14 PM
To: FreeTDS Development Group
Subject: [freetds] Re: connecting to remote MS Sql 2k server from linux PHP


On Oct 28, 2004, at 18:31, Rick D. Conner wrote:

At first sight I guessed this would be a file access rights problem
(the user PHP runs as doesn't have sufficient rights to read the config
file), but I'm not that sure anymore. In fact, it's probably something
else.
Several things look a bit weird to me.

First off, are you trying to use the php script via a web server, such
as Apache, or is it getting run via the command-line PHP interpreter?
It seems to be the latter. That's good, it makes it all simpler.

The weird bits:

The putenvs at the start of your script should already be too late in
the process to set them - maybe not, since you aren't running through a
web server -, yet the log files are obviously getting made and the
FREETDSCONF parameter is also seen as set.

Set wrongly, I might add, as it is supposed to be a file name, not the
name of a directory, according to the manual:
<http://www.freetds.org/userguide/envvar.htm>

Anyway, $HOME/.freetds.conf, $SYBASE/freetds.conf or {compile-time
freetds prefix}/etc/freetds.conf would get processed automatically
without setting any environment variables.

Further weirdness: according to the log, FreeTDS seems to find the
myserver2k entry in /home/bwelch/.freetds.conf anyway - but it ignores
it and doesn't seem to be looking for it, instead trying to find the
default SYBASE entry.

Then, despite all this, at the end it tries to connect to the mssql
default port 1433 even though the default should be sybase's port 5000
considering it failed to get anything useful from the config files.

So I have to conclude I'm a bit confused but the FreeTDS developers
will probably know the explanation right away. :)
In the meantime you should post the contents of all your
FreeTDS-related configuration files.

/home/bwelch/.freetds.conf and /usr/local/freetds/etc/freetds.conf

--
fds

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds


_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds






Archive powered by MHonArc 2.6.24.

Top of Page