473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

php freetds and iodbc

Hi everybody and first of all thank you very much for your help,
i am on a linux fedora core 5 server and i want to odbc connect to a windows 2003 server with MSSQL Server database.
the iODBC is the name i used for defining the dsn i have created in the odbc.ini file which looks like this

[ODBC Data Sources]
iODBC = MS SQL Server
MSSQL = MAVE

[MSSQL]
Driver = /usr/local/lib/libtdsodbc.so
Description = MSSQL
Trace = No
Server = xxx.xx.xx.xx
Database = databaseName
Port = xxxx //the default is 1433
Password = my password


[iODBC]
Driver = some dirs/libtdsodbc.so
Description = Sample iODBC Server
Host = xxx.xx.xx.xx
Server = xxx.xx.xx.xx
#Address = xxx.xx.xx.xx
Port = xxxx
#TraceFile = stdout
TraceFile = o.trc
Trace = 1 ; set to 1 to enable tracing
#UID = i use here the username of the db login
#Password = password
#PWD = password
Database = the database name
ServerType = MS SQL Server
Debug = 1
DebugFile = odbcdebug.log

[Default]
Driver = some dirs /libtdsodbc.so


i have performed the test that is in the iodbc openlink website (http://www.iodbc.org/index.php?page=...TO#php23039346)

and the result is the following

---------------------------------------------
Connecting...
Warning: odbc_connect() [function.odbc-connect]: SQL error: [FreeTDS][SQL Server]Read from SQL server failed., SQL state 08S01 in SQLConnect in ..... my website /odb.php on line 64

Uh-oh! Failure to connect to DSN [iODBC]:

--------------------------------------------------
for the error 08S01 microsoft says

The communication link between the driver and the data source to which the driver was attempting to connect failed before the function completed processing.

i say ?????????

I use iODBC driver manager and the actual driver is the FreeTDS driver.
The test tsql on command line is connecting without problems and i can also perform queries etc.... The problem comes when i try to use the function odbc_connect(). it is returning the error above. When i change the name of the DSN to something else i get the error

[iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in SQLConnect in .....

I used the trace file for iODBC and the result is the following:

** iODBC Trace file
** Trace started on Tue Apr 17 14:21:39 2007
** Driver Manager: 03.52.0507.0105


[000000.184459]
php 00000000 EXIT SQLConnect with return code -1 (SQL_ERROR)
SQLHDBC 0xa255090
SQLCHAR * 0xa25940c
SQLSMALLINT -3 (SQL_NTS)
SQLCHAR * 0xa2596ec
SQLSMALLINT -3 (SQL_NTS)
SQLCHAR * 0x575258
SQLSMALLINT -3 (SQL_NTS)

[000000.184627]
php 00000000 ENTER SQLError
SQLHENV 0xa259988
SQLHDBC 0xa255090
SQLHSTMT 0x0 (SQL_NULL_HANDLE)
SQLCHAR * 0xbfd2364e
SQLINTEGER * 0xbfd23654
SQLCHAR * 0xbfd2344e
SQLINTEGER 511
SQLSMALLINT * 0xbfd2365a

[000000.184711]
php 00000000 EXIT SQLError with return code 0 (SQL_SUCCESS)
SQLHENV 0xa259988
SQLHDBC 0xa255090
SQLHSTMT 0x0 (SQL_NULL_HANDLE)
SQLCHAR * 0xbfd2364e
| 08S01 |
SQLINTEGER * 0xbfd23654 (20004)
SQLCHAR * 0xbfd2344e
| [FreeTDS][SQL Server]Read from SQL serve |
| r failed. |
SQLINTEGER 511
SQLSMALLINT * 0xbfd2365a (49)

[000000.184914]
php 00000000 ENTER SQLFreeConnect
SQLHDBC 0xa255090

[000000.184965]
php 00000000 EXIT SQLFreeConnect with return code 0 (SQL_SUCCESS)
SQLHDBC 0xa255090

i dont understand a thing. PLEASE HELP.
Apr 23 '07 #1
2 3569
Motoma
3,237 Expert 2GB
Can you connect regularly? From the same machine? How about from another machine using the Windows Client Tools?
Apr 23 '07 #2
Can you connect regularly? From the same machine? How about from another machine using the Windows Client Tools?
i have tested the connection by adding my code on a windows machine and it worked great, but the settings of the php where diferent and the driver i used on that machine where the native odbc driver and the MSSQL Server driver which are not available on unix machines. Now i want to connect with the FreeTDS drivers supported by the iODBC Driver manager. This is totaly diferent now and the previews connection i made (on windows machine) tells me only that the connection with the remote machine can be established (port is open, password and username are correct ip address is correct and Generaly the DSN i use is correct except from the driver). Thank you very much for the reply and i hope this information helps
Apr 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Google Mike | last post by:
In the ongoing saga to get FreeTDS and/or ODBC to work in PHP/Linux, connecting to a remote MS SQL Server 2K system... I decided to try InlineTDS... I downloaded InlineTDS from...
0
by: Maneesh | last post by:
Hi, I want to connect to a remote MS SQL Server 2000 database through my Fedora Core 2 machine via Python scripts. I have successfully installed freetds & unixODBC and can now connect to the...
0
by: Greg | last post by:
Hi, Does anyone know what is the difference between the two ODBC systems ? Are there any other popular and established standards ? Thanks for the help. -greg
14
by: erezep | last post by:
I'm running a site balanced between 5 apache servers running on FC3, apache 2.0.53,php 4.3.4,freetds 0.63. I have this strange problem that sometimes, not even times of load, the connections...
1
by: Tim Perkins | last post by:
Okay, not much traffic on the postgres.odbc group so I'll try here. I'm trying to get postgresql and excel x to talk over odbc and a cup of tea but the psql odbc driver is not compiling for me...
1
by: Ajay | last post by:
Hi, Is freeTDS ODBC already ready? If yes, how to find it? Also, is it compatible to Windows: i.e. can itbe compiled on windows. Please tell me if youhave sonmeother ODBC solution also.
0
by: hassanali20 | last post by:
I've surfed this forum and found one thread which was talking about the same problem i've, but it didn't help in my situation. http://www.thescripts.com/forum/thread510563.html I could connect to...
4
by: eeb4u | last post by:
I am connecting to MS SQL 2000 from Red Hat EL4 using freetds and currently running queries to get counts on tables etc. When running SELECT queries I notice that the data returns and I have to...
0
by: masterorb | last post by:
Hi, I am trying to open a connection between a PHP page and MSSQL Server 2005 (as opposed to MySQL). I found a tool online that seems to accomplish this: http://www.freetds.org/. However, I get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.