[unixODBC-support] Problem between unixodbc and PHP5

Jean-Joseph YVON jj.yvon at dis-info.com
Tue Mar 27 17:07:10 BST 2012


Hi,

First, sorry for my english.

I need to creat an ODBC connection to a SQL Server for a web service in WINDEV
I am running unixODBC on an ubuntu server 11.10 X64, i have installed unixODBC and freeTDS with apt-get.
I have edited  odbcinst.ini like this :

[ODBC]
Trace           = Yes
TraceFile       = /var/log/odbc.log
ForceTrace      = Yes
Debug           = Yes
DebugFile       = /var/log/odbc.bug

[FreeTDS]
Description     = TDS driver
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup          = /usr/lib/odbc/libtdsS.so
CPTimeout      =
CPReuse        =
FileUsage       = 1

I have edited  odbc.ini like this :
[ODBC Data Sources]
MSZIMO          = mssql server

[MSZIMO]
Driver          = /usr/lib/odbc/libtdsodbc.so
Description     = ODBC connection via FreeTDS
Trace           = No
#Servername     = MSSQL
Server          = 192.168.10.201
Port            = 1433
TDS_Version     = 7.0
Database        = NEWZIMMO

I have used this command for a test :
isql -v MSZIMO login password
and  i can connect to my database

When i test from My web service or a php script i see no connection in log.
The php scrip i use for testing :

<?php
putenv("ODBCSYSINI=/etc/odbcinst.ini");
putenv("ODBCINI=/etc/odbc.ini");
echo "Connexion...<br>";
# connect to a DSN "MSZIMO"
$connect = odbc_connect("MSZIMO", "login", "password");
#result ID
echo $connect;
# query the agence table for all fields
$query = "SELECT * FROM agence";
echo $query;
# perform the query
$result = odbc_exec($connect, $query);
echo $result;
# close the connection
odbc_close($connect);
?>

Someone could help me ?
I don't see what i am doing wrong.

Jean-Joseph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20120327/8d10d027/attachment.html>


More information about the unixODBC-support mailing list