RE: [PHP] FreeTDS and SQL Server 7

From: Date: Wed, 17 Oct 2001 13:51:55 +0000
Subject: RE: [PHP] FreeTDS and SQL Server 7
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71337@lists.php.net to get a copy of this message
Thanks for you build record, that helped greatly, I think my main problem was using 0.52 instead of 0.51. No more seg faults now when I try to run my script, but I am still not getting a connection to the database, and I think the problem may be the fact the freetds is not finding any configuration information. Here is the php script I am running: <? putenv("TDSDUMP=/usr/local/apache_test/logs/tds.log"); $nDBConn = mssql_connect("mmg", "username", "passwd"); echo "ConnectID: $nDBConn<br>\n"; $nStmt = mssql_query("select * from david_test", $nDBConn); while ($aRow = mssql_fetch_array($nStmt)) { echo $aRow["Name"]; echo "<p>\n"; } mssql_close($nDBConn); echo "hello dave"; ?> And when this runs there are connection errors, but if I look in the TDSDUMP file I specified at the beginning of the script I see this (which is not the ip or port I specified in my interfaces file): 2001-10-17 09:39:24 Connecting addr 255.255.255.255 port 0 Along with these errors in my Apache error log file: connect: Network is unreachable DB-Library: Login incorrect. Here is my interfaces file, located at /usr/local/freetds mmg query tcp tds4.2 ip.of.db.server 1433 And last, here is the value of the SYBASE env variable: [root /root]# echo $SYBASE /usr/local/freetds Did you or anyone else run in to this problem? I looked in the config file to see if there was a path you could specify for the interfaces file but found only an alternate method of configuring freetds, so I renamed it to zzz_freetds.conf and still get the error message saying it is connecting to 255.255.255.255. Thanks again in advance for any help. David Derr davidderr@britsys.net -----Original Message----- From: Nick Talbott [mailto:nickt@powys.gov.uk] Sent: Tuesday, October 16, 2001 11:45 AM To: David Derr; php-general@lists.php.net Subject: Re: [PHP] FreeTDS and SQL Server 7 On Tuesday 16 October 2001 4:18 pm, David Derr wrote: > Hey all, I was reading an old article at php builder about conntecting > to SQL Server 7 on a Windows machine from a Linux machine via FreeTDS. > (http://www.phpbuilder.com/columns/alberto20000919.php3) [snip] > > Has anyone had sucees in getting this to work? I will include my > config and compile commands below as well as the php script that is > breaking things. [snip] We have that working reliably with the exception that I have used TDS protocol version 4.2 rather than 7.0 because I had read that this was a little less well developed, and 4.2 gives you all you need in any case. We're using slightly different components: Apache 1.3.20, PHP 4.0.6, FreeTDS 0.51 running on a Slackware 8.0 base (Linux kernel 2.2.19 with glibc 2.2.3) I've attached an HTML file of our build record for this. The other thing to note is that this approach allows you to use PHP's mssql_ calls, but only those that have direct sybase_ equivalents. So make sure you check out which calls are common to both sets of functions and don't try calls that only exist in the mssql_ function list. Regards Nick Talbott, IT Policy and Strategy Manager, Powys County Council email: nickt@powys.gov.uk fax: 01597 824781 web: www.powys.gov.uk and www.powysweb.co.uk

« previous php.general (#71337) next »