Skip to Content.
Sympa Menu

freetds - [freetds] PHP odbc_connect : sql error

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Rowland, TJ (LVA)" <TJ.Rowland AT lva.virginia.gov>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] PHP odbc_connect : sql error
  • Date: Mon, 15 Dec 2008 22:38:37 -0500

Hi all.

I am attempting to connect to MS Sql Server from Linux (RHEL 5) via
ODBC/FreeTDS and PHP, but keep having troubles and was wondering if anyone
could steer me in the right direction.

I can connect to SQL Server with both tsql and isql, and also from a shell
using the php command. However, whenever I attempt to access the php page
through a browser, I receive the following error:

odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][FreeTDS][SQL
Server]Unable to connect to data source, SQL state S1000 in SQLConnect in
/var/www/html/mysqltest.php on line 12

I checked my freetds.log file and the following errors were noted:
net.c:204:Connecting to 10.1.1.51 port 1214 (TDS version 5.0)
net.c:258:tds_open_socket: connect(2) returned "Permission denied"
util.c:334:tdserror(0xa618960, 0xa61db08, 20009, 13)
odbc.c:2102:msgno 20009 20003
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
net.c:303:tds_open_socket() failed
mem.c:609:tds_free_all_results()
error.c:409:odbc_errs_add: "Unable to connect to data source"

I thought it might be a firewall problem, but after disabling my firewall
(/etc/init.d/iptables stop) the problem persists.

Also, I created a simple phpinfo.php file (<?php phpinfo() ?>) to check for
differences in configuration between the php shell cmd and php called from
the browser, but found no major differences. So I'm stumped.

If anyone could lend a hand, point me in the right direction or share some
insight, it would be greatly appreciated. Thank you.








Archive powered by MHonArc 2.6.24.

Top of Page