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: Un Named <jimthefreeman AT yahoo.com>
  • 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: Tue, 23 Jan 2007 03:47:38 -0800 (PST)


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
MS db-lib source compatibility: yes
Sybase binary compatibility: unknown
Thread safety: yes
iconv library: yes
TDS version: 8.0
iODBC: no
unixodbc: no

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.
02:30:59.505951 1052 (write.c:134):tds_put_string converting 8 bytes of
"softlink"
02:30:59.506271 1052 (write.c:162):tds_put_string wrote 16 bytes
02:30:59.506321 1052 (write.c:134):tds_put_string converting 2 bytes of "sa"
02:30:59.506360 1052 (write.c:162):tds_put_string wrote 4 bytes
02:30:59.506398 1052 (write.c:134):tds_put_string converting 4 bytes of
"TSQL"
02:30:59.506434 1052 (write.c:162):tds_put_string wrote 8 bytes
02:30:59.506467 1052 (write.c:134):tds_put_string converting 12 bytes of
"192.168.55.3"
02:30:59.506503 1052 (write.c:162):tds_put_string wrote 24 bytes
02:30:59.506536 1052 (write.c:134):tds_put_string converting 11 bytes of
"TDS-Library"
02:30:59.506571 1052 (write.c:162):tds_put_string wrote 22 bytes
02:30:59.506604 1052 (write.c:134):tds_put_string converting 10 bytes of
"us_english"
02:30:59.506640 1052 (write.c:162):tds_put_string wrote 20 bytes
02:30:59.506673 1052 (write.c:162):tds_put_string wrote 0 bytes
02:30:59.506849 1052 (token.c:310):tds_process_login_tokens()
02:30:59.508366 1052 (net.c:446):Received header
0000 04 01 01 95 00 33 01 00- |.....3..|

[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.
02:31:37.446876 1059 (write.c:134):tds_put_string converting 8 bytes of
"softlink"
02:31:37.447186 1059 (write.c:162):tds_put_string wrote 16 bytes
02:31:37.447269 1059 (write.c:134):tds_put_string converting 2 bytes of "sa"
02:31:37.447311 1059 (write.c:162):tds_put_string wrote 4 bytes
02:31:37.447349 1059 (write.c:134):tds_put_string converting 7 bytes of "PHP
4.0"
02:31:37.447385 1059 (write.c:162):tds_put_string wrote 14 bytes
02:31:37.447418 1059 (write.c:134):tds_put_string converting 12 bytes of
"192.168.55.3"
02:31:37.447453 1059 (write.c:162):tds_put_string wrote 24 bytes
02:31:37.447485 1059 (write.c:134):tds_put_string converting 10 bytes of
"DB-Library"
02:31:37.447520 1059 (write.c:162):tds_put_string wrote 20 bytes
02:31:37.447553 1059 (write.c:134):tds_put_string converting 10 bytes of
"us_english"
02:31:37.447587 1059 (write.c:162):tds_put_string wrote 20 bytes
02:31:37.447620 1059 (write.c:162):tds_put_string wrote 0 bytes
02:31:37.447814 1059 (token.c:310):tds_process_login_tokens()
02:31:37.449340 1059 (net.c:446):Received header
0000 04 01 00 74 00 33 01 00- |...t.3..|


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?

Thank you for your time, any help is appreciated.

Jim



Un Named <jimthefreeman AT yahoo.com> wrote: Hello James,

The problem is that I do have the user and password specified exists. For
security reasons I replaced the user and password with 'user' and 'password'
and hit the php again to get that reply. As I told you even if I put the
right user and passoword I got same message. Does this helps?

Jim

"Lowden, James K" wrote:
> From: Un Named
> Subject: [freetds] MS SQL 2005 + PHP 5.20 + FreeTDS 9.64
mssql_connectfailed (Login incorrect...)
>
> I am trying to perform some simple queries agains a
> remote MS SQL 2005 server. If I am trying with a
> SQL manager, i.e. EMS SQL Manager 2005 Lite fro SQL Server,
> I can connect and do the queries; hoever if I am
> trying with a simple php code it doesn't.
...
> [PHP Code]
> > $dbhost = "Server_IP:1433";
> $dbuser = "user";
...
> 11:16:16.970076 23964 (net.c:542):Received packet
> 0000 aa 52 00 18 48 00 00 01-0e 1d 00 4c 00 6f 00 67 |.R..H...
...L.o.g|
> 0010 00 69 00 6e 00 20 00 66-00 61 00 69 00 6c 00 65 |.i.n. .f
.a.i.l.e|
> 0020 00 64 00 20 00 66 00 6f-00 72 00 20 00 75 00 73 |.d. .f.o .r.
.u.s|
> 0030 00 65 00 72 00 20 00 27-00 75 00 73 00 65 00 72 |.e.r. .'
.u.s.e.r|
> 0040 00 27 00 2e 00 06 42 00-4c 00 4f 00 4f 00 4b 00 |.'....B.
L.O.O.K.|

That's the server telling you "Login failed for user 'user'". Unless
you have a user whose name is 'user' and whose password is 'password',
that's the message I'd expect to see.

What else do you want to know?

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



---------------------------------
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



---------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.




Archive powered by MHonArc 2.6.24.

Top of Page