Skip to Content.
Sympa Menu

freetds - [freetds] 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 AT lists.ibiblio.org>
  • Subject: [freetds] connecting to remote MS Sql 2k server from linux PHP
  • Date: Thu, 28 Oct 2004 12:31:22 -0400

Hello Mailing List,



I'm a newbie to this whole FreeTDS and MS SQL thing. What I'm trying to do
for a client is connect his website (which uses Linux and MySql databases)
to his local machine (running WIN2k and SQL2k). I've had the FreeTDS library
installed by the web host. I can telnet to the "local" machine using the IP
and Port. BUT, when a connection attempt is made from PHP, I get nothing.
Just like the "local" server isn't there. I have enabled the config log and
the basic log. Below is the code I'm using to connect, and the contents of
the log files. My client is getting tired of waiting on this to work, and
I'm looking for any help available.





Test.php =======================================

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

<?php

putenv('TDSDUMP=/home/bwelch/tds.log.txt');

putenv('TDSDUMPCONFIG=/home/bwelch/tds.config.txt');

putenv('SYBASE=/usr/local/freetds');

putenv('FREETDSCONF=/home/bwelch/');

$conn = "MyServer2k";

$username = "Website";

$password = "bwelch";



$msconnect=mssql_connect("$conn","$username","$password");

$msdb=mssql_select_db("Northwind",$msconnect);

$msquery = "select titleofcourtesy,firstname,lastname from employees";

$msresults= mssql_query($msquery);

while ($row = mssql_fetch_array($msresults)) {

echo "<li>" . $row['titleofcourtesy'] . " " . $row['firstname'] . " "
. $row['lastname'] . "</li>\n";

}

?>





Tds.config.txt ===================================

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

Starting log file for FreeTDS 0.62.3

on 2004-10-28 12:15:56 with debug level 99.

12:15:56.815338 Attempting to read conf files.

12:15:56.815364 Found conf file '/home/bwelch/' (from $FREETDSCONF). Reading
section 'SYBASE'.

12:15:56.815386 Looking for section global.

12:15:56.815411 Looking for section SYBASE.

12:15:56.815428 ...'SYBASE' not found.

12:15:56.815449 ...$FREETDS not set. Trying $HOME.

12:15:56.816183 Found conf file '/home/bwelch/.freetds.conf'
(.freetds.conf). Reading section 'SYBASE'.

12:15:56.816206 Looking for section global.

12:15:56.816259 ... Found section global.

12:15:56.816275 Got a match.

12:15:56.816290 option = 'tds version' value = '4.2'.

12:15:56.816330 option = 'text size' value = '64512'.

12:15:56.816351 ... Found section jdbc.

12:15:56.816371 ... Found section jdbc_42.

12:15:56.816392 ... Found section mypool.

12:15:56.816412 ... Found section myserver2k.

12:15:56.816435 Looking for section SYBASE.

12:15:56.816477 ... Found section global.

12:15:56.816517 ... Found section jdbc.

12:15:56.816538 ... Found section jdbc_42.

12:15:56.816559 ... Found section mypool.

12:15:56.816579 ... Found section myserver2k.

12:15:56.816600 ...'SYBASE' not found.

12:15:56.833922 Found conf file '/usr/local/freetds/etc/freetds.conf'
(default). Reading section 'SYBASE'.

12:15:56.833962 Looking for section global.

12:15:56.843105 ... Found section global.

12:15:56.843123 Got a match.

12:15:56.843138 option = 'tds version' value = '4.2'.

12:15:56.843177 option = 'text size' value = '64512'.

12:15:56.843198 ... Found section jdbc.

12:15:56.843219 ... Found section jdbc_42.

12:15:56.843240 ... Found section mypool.

12:15:56.843270 ... Found section tds.

12:15:56.843293 Looking for section SYBASE.

12:15:56.843336 ... Found section global.

12:15:56.843376 ... Found section jdbc.

12:15:56.843396 ... Found section jdbc_42.

12:15:56.843488 ... Found section mypool.

12:15:56.843523 ... Found section tds.

12:15:56.843543 ...'SYBASE' not found.

12:15:56.843569 Failed in reading conf file. Trying interface files.

12:15:56.843593 Looking for server SYBASE....

12:15:56.844309 Looking for server in /home/bwelch/.interfaces.

12:15:56.844327 Searching interfaces file //home/bwelch/.interfaces.

12:15:56.844357 Couldn't open /home/bwelch/.interfaces.

12:15:56.844373 Looking for server in /usr/local/freetds/interfaces.

12:15:56.844391 Searching interfaces file /usr/local/freetds/interfaces.

12:15:56.848738 Couldn't open /usr/local/freetds/interfaces.

12:15:56.848784 Setting 'ip_port' to 1433 as a guess.

12:15:56.894858 Setting 'dump_file' to '/home/bwelch/tds.log.txt' from
$TDSDUMP.







Tds.log.txt =====================================

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

Starting log file for FreeTDS 0.62.3

on 2004-10-28 12:15:56 with debug level 99.

iconv to convert client-side data to the "ISO-8859-1" character set

12:15:56.895080 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"

12:15:56.895106 IP address pointer is NULL

12:15:56.895122 Server SYBASE not found!







Rick D. Conner

Rick AT WeDoSites.com

http://www.wedosites.com









Archive powered by MHonArc 2.6.24.

Top of Page