Skip to Content.
Sympa Menu

freetds - RE: [freetds] Re: PHP & FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Walls Rob W Contr 75 CS/SCBS <Rob.Walls AT HILL.af.mil>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Re: PHP & FreeTDS
  • Date: Tue, 24 Aug 2004 17:09:16 -0600

Thanks,
I used /usr instead of /usr/lib and followed the file at
http://www.unixodbc.org/doc/FreeTDS.html. Once I cleaned up all the other
files from botched installs and paid attention to where files were being
installed, and used odbcinst directly, isql started working using a user DSN
to a MS SQL server! This is great, but PHP still can't see the data source.
The ODBCConfig GUI tool gives errors, too. "Could not construct a property
list for (TDS)", which is the name of the driver I installed. I don't know
if that is at all related to the next problem.

I know this is not a PHP group, but I hoping someone knows what to do to
make this work with PHP without recompiling. Isql works fine with a user
dsn. I made a system DSN using odbcinst that was identical to the user DSN,
but odbc through that DSN with PHP doesn't work. I get a

Warning: SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data
source, SQL state S1000 in SQLConnect in /usr/share/php/common.inc on line
25

I'm using this code to connect:

$connection_string =
'DRIVER=TDS;SERVERNAME=db75cs-891-3;UID=$DB_LOGIN;PWD=$DB_PASSWORD;DATABASE=
$DB;';
$connection = odbc_connect( $connection_string, $DB_LOGIN, $DB_PASSWORD);

PHP finds an odbc.ini file in /etc/php.d/ which loads /usr/lib/php4/odbc.so
as an extension. So, shouldn't PHP be able to use a DSN just like isql? Is
the connect string I'm using bad?


Rob Walls
75 CS/SCBS
Hill AFB, UT 84056
PH (801) 777-2230
DSN 777-2230


-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of James K. Lowden
Sent: Tuesday, August 24, 2004 3:20 AM
To: FreeTDS Development Group
Subject: Re: [freetds] Re: PHP & FreeTDS

On Mon, 23 Aug 2004 13:15:30 -0600, Walls Rob W Contr 75 CS/SCBS
<Rob.Walls AT HILL.af.mil> wrote:
> I got the unixODBC dev rpm and used
> ./configure --with-tdsver=7.0 --with-unixodbc=/usr/lib (RedHat's
> unixODBC RPM puts .so files in /usr/lib and puts .h files in
> /usr/include)

Close, but no cigar. :-) Try:

./configure --with-tdsver=7.0 --with-unixodbc=/usr

You're not directing the linker to the libraries. You're directing the
whole build to the unixODBC files, both headers and libraries. The
configure script assumes there will be lib/ and include/ relative paths
beneath whatever you pass to --with-unixodbc.

HTH.

--jkl
_______________________________________________
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