Skip to Content.
Sympa Menu

freetds - [freetds] Connection problem from php : Unable to connect to data source, SQL state S1000 in SQLConnect

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Marc-André Legrand <legrandmarc20 AT hotmail.com>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Connection problem from php : Unable to connect to data source, SQL state S1000 in SQLConnect
  • Date: Wed, 3 Oct 2012 10:02:04 +0200




Hello everybody,

I have difficult to connect from php to MS SQL Server. I have the following
message in php page :

[unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state
S1000 in SQLConnect


I made an installation Freetds via yum install . I configured freedts.conf in
/etc/ folder .

Here is the code in /etc/freetds.conf

# $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".
# Global settings are overridden by those in a database
# server specific section
[global]
# TDS protocol version
; tds version = 4.2
# Whether to write a TDSDUMP file for diagnostic purposes
# (setting this to /tmp is insecure on a multi-user system)
; dump file = /tmp/freetds.log
; debug flags = 0xffff
# Command and connection timeouts
; timeout = 10
; connect timeout = 10
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
# A typical Sybase server
;[egServer50]
; host = symachine.domain.com
; port = 5000
; tds version = 5.0
# A typical Microsoft server
;[egServer70]
; host = ntmachine.domain.com
; port = 1433
; tds version = 7.0
[TDS]
host = <My IP Address>
port = 1433
tds version = 8.0


Here is my /etc/odbcinst.ini file :

[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1

[FreeTDS]
Description = v0.64 with protocol v8.0
Driver = /usr/lib64/libtdsodbc.so.0
ForceTrace = Yes
Trace = Yes
TraceFile = /tmp/sql.log
UsageCount = 1

And this my php code to connect to SQL Server :

$connexion_mssql_reussie = true;

$dsn="Driver=FreeTDS;Server=<My IP Address>;Database=<My database>;UID=<User
name>;Pwd=<My password>";
if(($conn=odbc_connect($dsn,'','')) == TRUE){
$connexion_mssql_reussie = true;
}else{
die("Erreur de connexion");

}


I use a CentOS web server and SQL Server 2008 with Windows 2008 server .

I would like to know if I forgot something .

Thank you for your reply .

Best regards.




Archive powered by MHonArc 2.6.24.

Top of Page