freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT umcc.ais.org>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: via PHP to Microsoft SQL Server V7.0
- Date: Mon, 17 Jan 2000 20:00:41 -0500 (EST)
On Tue, 18 Jan 2000, James Cameron wrote:
> Brian Bruns wrote:
> > Can you provide a bit more info about your environment...What your
> > $SYBASE var is set to, a copy of the interfaces file entry, etc... also
> > does it run ok when using an IP address instead of a hostname?
>
> This may be my problem. I have no idea what this SYBASE environment
> variable is for, nor why I should have an interfaces file.
>
> Can you tell me what I should set these to? Or point to documentation
> that explains them?
>
> I had assumed that I need only place the DNS host name or IP address
> into the sybase_connect() call in PHP.
>
Ahh, this is making a little more sense now. Well basically the $SYBASE
variable and the interfaces files are there becasue of historical reasons.
Sybase (which MS SQL Server is based on) used the interfaces file to
store the hostname and port of each server. (there used to be seperate
console services and stuff to but those are gone). Anyway, the SYBASE
variable was how Sybase found its home directory which contains the
interfaces file, header files, libraries, locales and other garbage.
So, long story short, if you did a default install of freetds you wound up
with a interfaces file in /usr/local/freetds (otherwise it is whereever
you specified --prefix). So, the thing to do would be to edit that file
to add your server....just follow the examples, and that should work. MS
SQL has a default port of 1433. Then you need to set the environment
variable. You can do this one of two ways for Apache/PHP.
1) 'export SYBASE=/usr/local/freetds' before starting the apache process
2) use the SetEnv directive in your httpd.conf file and restart apache
I use option 2 myself.
> <?php
> $link = sybase_connect("10.0.0.2","user","pass");
> if ($link == 0) {
> echo "sybase_connect failed\n";
> exit;
> }
> printf("link=%d\n", $link);
> $result = sybase_query("select * from tables", $link);
> while($row = sybase_fetch_row($result)) {
> echo "<hr>".stripslashes($row[0])."\n";
> }
> sybase_free_result($result);
> $status = sybase_close($link);
> ?>
>
> --
> James Cameron (cameron AT stl.dec.com)
>
-
via PHP to Microsoft SQL Server V7.0,
James Cameron, 01/17/2000
- <Possible follow-up(s)>
- Re: via PHP to Microsoft SQL Server V7.0, Francis Smit, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, James Cameron, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, James Cameron, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, James Cameron, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, James Cameron, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, richard, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, James Cameron, 01/17/2000
- Re: via PHP to Microsoft SQL Server V7.0, Brian Bruns, 01/17/2000
Archive powered by MHonArc 2.6.24.