Skip to Content.
Sympa Menu

freetds - RE: PHP, FreeTDS and SQL Server 7

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "David Derr" <david.derr AT milesmedia.com>
  • To: "'Richard Norman'" <normri AT samc.com>, <freetds AT franklin.oit.unc.edu>
  • Subject: RE: PHP, FreeTDS and SQL Server 7
  • Date: Thu, 18 Oct 2001 12:42:06 -0400


I just tried that and I still get the notice via TDSDUMP that it is
trying to connect to 255.255.255.255 port 0. This seems kind of strange
- I am not sure it is looking in the right place at all for this
information. Is there some way I can see where freetds is getting it's
configuration info?

Thanks,
David Derr

-----Original Message-----
From: Richard Norman [mailto:normri AT samc.com]
Sent: Thursday, October 18, 2001 12:01 PM
To: freetds AT franklin.oit.unc.edu; david.derr AT milesmedia.com
Subject: RE: [freetds] PHP, FreeTDS and SQL Server 7


Did you try using the freetds.conf file?

This file is used before the interfaces file. you can find it in your
%prefix%/etc directory if you specified this location.

I discovered that when I was doing my initial work with FreeTDS..

Richard Norman

-----Original Message-----
From: david.derr AT milesmedia.com
Sent: Thursday, October 18, 2001 7:17 AM
To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
Subject: [freetds] PHP, FreeTDS and SQL Server 7



Hello. I am trying to use freetds in conjunction with php and
MS SQL
Server 7. I have posted a couple quiestions to the php mailing list,
but
have hit a wall there.

I have included the reply I recieved to the first post and my
second post
below. I believe I have a configuration problem unrelated to php or the

database because it seems freetds always wants to connect to
255.255.255.255 port 0 and that is not what I had in the interfaces
file.

Any help would be greatly appreciated. I am sooo close and I
really hope
this solution will perform better than our existing one which is using
an
ODBC bridge.

Thanks!
David Derr


Posteded to the PHP General Mailing List...

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 AT britsys.net


Original Message
From: Nick Talbott [ mailto:nickt AT powys.gov.uk]
Sent: Tuesday, October 16, 2001 11:45 AM
To: David Derr; php general AT 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 <BR>
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 AT powys.gov.uk
fax: 01597 824781
web: www.powys.gov.uk and www.powysweb.co.uk



You are currently subscribed to freetds as: [normri AT samc.com]
To unsubscribe, forward this message to leave freetds
137192W AT franklin.oit.unc.edu







Archive powered by MHonArc 2.6.24.

Top of Page