Skip to Content.
Sympa Menu

freetds - [freetds] Freetds works in commandline but not with apache/php

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Johan Thorvaldsson <johan.thorvaldsson AT zombaio.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Freetds works in commandline but not with apache/php
  • Date: Wed, 19 Jan 2011 16:17:21 +0100

I'm new to this maillist and I have completely got stucked when it comes to
making a successful connection to mssql from a ubuntu server 10.10 (maverick).

The connection works in bash with tsql, here is output of tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.82
freetds.conf directory: /etc/freetds
MS db-lib source compatibility: no
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes

Some queries work like:
SELECT ba.Bank_Account_ID, ba.Bank_Account_Type, ba.Bank_Account_Alias,
bat.Description, bat.Currency FROM Bank_Accounts AS ba
INNER JOIN Bank_Account_Type AS bat ON bat.ID =
ba.Bank_Account_Type
WHERE ba.Bank_Account_Owner_User_ID = '111222'

But this do not work:
SELECT

Account_Users.*,Account_Users_Type.Description AS Account_Type_Description,
Account_Users_Status.ViewVerificationProcess
FROM Account_Users
INNER JOIN Account_Users_Status ON
Account_Users_Status.ID = Account_Users.Account_Status
INNER JOIN Account_Users_Type ON
Account_Users_Type.ID = Account_Users.Account_Type
WHERE Account_Email = '<login>' AND
Account_Password = 'md5-hash'
AND Account_Users_Status.Access = 1
AND Account_Users.FailedLogon_Counter < 3

The last query returns nothing to the browser ( apache/php ). It works fine
in Microsoft SQL Server Management Studio.

Here is output of freetds.log:

log.c:190:Starting log file for FreeTDS 0.82
on 2011-01-19 15:13:21 with debug flags 0x4fff.
iconv.c:197:names for ISO-8859-1: ISO-8859-1
iconv.c:197:names for UTF-8: UTF-8
iconv.c:197:names for UCS-2LE: UCS-2LE
iconv.c:197:names for UCS-2BE: UCS-2BE
iconv.c:363:iconv to convert client-side data to the "ANSI_X3.4-1968"
character set
iconv.c:516:tds_iconv_info_init: converting "US-ASCII"->"UCS-2LE"
iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
net.c:210:Connecting to 10.0.0.102 port 1433 (TDS version 8.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:303:tds_open_socket() succeeded
util.c:162:Changed query state from DEAD to IDLE
login.c:735:quietly sending TDS 7+ login packet
token.c:312:tds_process_login_tokens()
net.c:592:Received header

On the query that fails the log ends with:
dblib.c:1961:dbnextrow() dbresults_state = 2 (_DB_RES_RESULTSET_ROWS)
token.c:495:tds_process_tokens(0x22b5f6d0, 0xbfbd8dfc, (nil), 0x1508)
util.c:162:Changed query state from PENDING to READING
token.c:510:processing result tokens. marker is fd(DONE)
token.c:2201:tds_process_end: more_results = 0
was_cancelled = 0
error = 0
done_count_valid = 1
token.c:2217:tds_process_end() state set to TDS_IDLE
util.c:162:Changed query state from READING to IDLE
token.c:2232: rows_affected = 1
util.c:110:logic error: cannot change query state from IDLE to PENDING
dblib.c:2030:leaving dbnextrow() returning NO_MORE_ROWS

I have configured freetds latest stable with:
./configure --prefix=/usr/local/freetds --with-tdsver=8.0

And after that installed php with apt-get, and then recomplied the php
modules mssql with:
./configure --with-mssql=/usr/local/freetds
And copied mssql.so to php extension-folder. It turns up ok in phpinfo.

Is there someone who could help me out here?

Thanks

Regards
Johan



Archive powered by MHonArc 2.6.24.

Top of Page