Skip to Content.
Sympa Menu

freetds - Re: [freetds] MS SQL 2005 + PHP 5.20 + FreeTDS 9.64 mssql_connectfailed (Login incorrect...)

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] MS SQL 2005 + PHP 5.20 + FreeTDS 9.64 mssql_connectfailed (Login incorrect...)
  • Date: Wed, 24 Jan 2007 21:33:12 -0500

Un Named wrote:
>
> I tried to connect using tsql and it is working. Here is a tsql -C
> output:
>
> [root@softlink bin]# tsql -C
> Compile-time settings (established with the "configure" script):
> Version: freetds v0.64
...
> However it does not connect from PHP 5.20 or 4.4.0. The logs differences
> are shown bellow:
>
> [working - running by tsql]
> ....
> 02:30:59.504763 1052 (iconv.c:361):iconv to convert client-side data to
> the "UTF-8" character set
> 02:30:59.504906 1052 (iconv.c:514):tds_iconv_info_init: converting
> "UTF-8"->"UCS-2LE"
> 02:30:59.505100 1052 (iconv.c:514):tds_iconv_info_init: converting
> "ISO-8859-1"->"UCS-2LE"
> 02:30:59.505193 1052 (net.c:168):Connecting to 192.168.55.3 port 1433.
...
> [non working - running by php]
> ....
> 02:31:37.444823 1059 (iconv.c:361):iconv to convert client-side data to
> the "ISO-8859-1" character set
> 02:31:37.444969 1059 (iconv.c:514):tds_iconv_info_init: converting
> "ISO-8859-1"->"UCS-2LE"
> 02:31:37.445067 1059 (iconv.c:514):tds_iconv_info_init: converting
> "ISO-8859-1"->"UCS-2LE"
> 02:31:37.445145 1059 (net.c:168):Connecting to 192.168.55.3 port 1433.
...
> The main difference here appears to be the charset that is set as UTF-8
> in TSQL query regardless of freetds.conf that I specified in cmd line.
> PHP appears to use ISO-8859-1, is this the reason of failure and if so
> is there a fix? Or it is a library
> issue?

Jim,

ISO 8589-1 and UTF-8 are the same in the ASCII range, i.e. for values
[0,127]. Unless your username or password includes non-ASCII characters,
I don't see how it's possible for the iconv conversion to present the
server with different strings. If you want to make sure, you can expose
them in the log: delete the tdsdump_off() and tdsdump_on() lines at
src/tds/login.c:768 and rebuild. I think if you re-run the tests, you'll
see the same login packet being sent. (You need reinstall only FreeTDS.
Score one for dynamic linking.)

Other than that, I'm unfortunately stumped. You're using db-lib in PHP;
you can confirm that db-lib can log in by trying bsqldb. But I'm sure
that will work, too, which leads us back to why PHP can't log in, and I
just don't see any reason.

This is a SQL Server account, yes, not a domain login? Just trying to
narrow the scope. Both should work just fine. And just to eliminate the
possibility, try using TDS versions 7.0 and 4.2, too.

Stumped in New York, and no snow, either.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page