Skip to Content.
Sympa Menu

freetds - Re: [freetds] Sybase ASA 7, unixODBC problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: lsunley AT mb.sympatico.ca
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Sybase ASA 7, unixODBC problem
  • Date: Sat, 06 Nov 2004 21:02:21 -0500

Hi all,

With no "Servername" key
and the keys

"Server=SQLServer" random value...
"Address=sqlhost" actual hostname

This is the login packet

NOTE - it used "SQLServer" as the (TDSLOGIN)server_name
and used "Address" to locate the actual host IP address
(TDSCONNECTINFO)ip_addr

Lorne

Starting log file for FreeTDS 3.51.0
on 2004-11-06 21:01:21 with debug level 99.
21:01:21 tds_iconv_open ISO-8859-1 .
tds_iconv_open
testing iconv_initialized
calling tds_iconv_init
calling iconv_open
Using trivial iconv from
iconv.c
iconv_open bad cd size
calling iconv_open search for UCS-2LE ISO-8859-1 iconv_t = 43122748
calling iconv_open search for UCS-2BE
doing long search
names for ISO-8859-1: ISO-8859-1
names for UTF-8: UTF-8
names for UCS-2LE: UCS-2LE
names for UCS-2BE: (null)
tds_iconv_init returning
iconv to convert client-side data to the "ISO-8859-1" character set
21:01:21 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" 21:01:21
tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" 21:01:21
Connecting to 192.168.1.4 port 1433, TDS 7.0. 21:01:21 TDS7_send_login to
192.168.1.4 port 1433, TDS 7.0.
21:01:21 tds_put_string entered with S01060080c8f879e3 len=17 21:01:21
tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string converting 17 bytes of "S01060080c8f879e3"
21:01:21 tds_put_string wrote 34 bytes
21:01:21 tds_put_string entered with sa len=2
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string converting 2 bytes of "sa"
21:01:21 tds_put_string wrote 4 bytes
21:01:21 tds_put_string entered with len=0
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string wrote 0 bytes
21:01:21 tds_put_string entered with SQLServer len=9
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string converting 9 bytes of "SQLServer"
21:01:21 tds_put_string wrote 18 bytes
21:01:21 tds_put_string entered with len=0
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string wrote 0 bytes
21:01:21 tds_put_string entered with us_english len=10
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string converting 10 bytes of "us_english"
21:01:21 tds_put_string wrote 20 bytes
21:01:21 tds_put_string entered with tessql len=6
21:01:21 tds_put_string min bytes 1 max bytes 1
21:01:21 tds_put_string converting 6 bytes of "tessql"
21:01:21 tds_put_string wrote 12 bytes
21:01:21 tds_process_login_tokens()
Received header @ 21:01:21
0000 04 01 01 94 00 00 00 00- |........|


Received packet @ 21:01:21
0000 e3 1b 00 01 06 74 00 65-00 73 00 73 00 71 00 6c |.....t.e .s.s.q.l|
0010 00 06 6d 00 61 00 73 00-74 00 65 00 72 00 ab 60 |..m.a.s. t.e.r..`|
0020 00 45 16 00 00 02 00 25-00 43 00 68 00 61 00 6e |.E.....% .C.h.a.n|
0030 00 67 00 65 00 64 00 20-00 64 00 61 00 74 00 61 |.g.e.d. .d.a.t.a|
0040 00 62 00 61 00 73 00 65-00 20 00 63 00 6f 00 6e |.b.a.s.e . .c.o.n|
0050 00 74 00 65 00 78 00 74-00 20 00 74 00 6f 00 20 |.t.e.x.t . .t.o. |
0060 00 27 00 74 00 65 00 73-00 73 00 71 00 6c 00 27 |.'.t.e.s .s.q.l.'|
0070 00 2e 00 05 53 00 52 00-56 00 4e 00 54 00 00 00 |....S.R. V.N.T...|
0080 00 e3 17 00 02 0a 75 00-73 00 5f 00 65 00 6e 00 |......u. s._.e.n.|
0090 67 00 6c 00 69 00 73 00-68 00 00 ab 64 00 47 16 |g.l.i.s. h...d.G.|
00a0 00 00 01 00 27 00 43 00-68 00 61 00 6e 00 67 00 |....'.C. h.a.n.g.|
00b0 65 00 64 00 20 00 6c 00-61 00 6e 00 67 00 75 00 |e.d. .l. a.n.g.u.|
00c0 61 00 67 00 65 00 20 00-73 00 65 00 74 00 74 00 |a.g.e. . s.e.t.t.|
00d0 69 00 6e 00 67 00 20 00-74 00 6f 00 20 00 75 00 |i.n.g. . t.o. .u.|
00e0 73 00 5f 00 65 00 6e 00-67 00 6c 00 69 00 73 00 |s._.e.n. g.l.i.s.|
00f0 68 00 2e 00 05 53 00 52-00 56 00 4e 00 54 00 00 |h....S.R .V.N.T..|
0100 00 00 e3 0f 00 03 05 69-00 73 00 6f 00 5f 00 31 |.......i .s.o._.1|
0110 00 01 00 00 e3 0b 00 05-04 31 00 30 00 33 00 33 |........ .1.0.3.3|
0120 00 00 e3 0f 00 06 06 31-00 39 00 36 00 36 00 30 |.......1 .9.6.6.0|
0130 00 39 00 00 ad 36 00 01-07 00 00 00 16 4d 00 69 |.9...6.. .....M.i|
0140 00 63 00 72 00 6f 00 73-00 6f 00 66 00 74 00 20 |.c.r.o.s .o.f.t. |
0150 00 53 00 51 00 4c 00 20-00 53 00 65 00 72 00 76 |.S.Q.L. .S.e.r.v|
0160 00 65 00 72 00 00 00 00-00 07 00 04 27 e3 13 00 |.e.r.... ....'...|
0170 04 04 34 00 30 00 39 00-36 00 04 34 00 30 00 39 |..4.0.9. 6..4.0.9|
0180 00 36 00 fd 00 00 00 00-00 00 00 00 |.6...... ....|



In <0I6S00G1WFPF84@l-daemon>, on 11/06/04
at 08:44 PM, lsunley AT mb.sympatico.ca said:

>With "Server" specified in the ODBC.ini I see this for the login NOTE
>sqlhost is the "Server" specified in my ODBC.ini file

>Lorne


>starting log file for FreeTDS 3.51.0
> on 2004-11-06 20:42:20 with debug level 99.
>20:42:20 tds_iconv_open ISO-8859-1 .
>tds_iconv_open
>testing iconv_initialized
>calling tds_iconv_init
>calling iconv_open
>Using trivial iconv from
> iconv.c
>iconv_open bad cd size
>calling iconv_open search for UCS-2LE ISO-8859-1 iconv_t = 43122748
>calling iconv_open search for UCS-2BE
>doing long search
>names for ISO-8859-1: ISO-8859-1
>names for UTF-8: UTF-8
>names for UCS-2LE: UCS-2LE
>names for UCS-2BE: (null)
>tds_iconv_init returning
>iconv to convert client-side data to the "ISO-8859-1" character set
>20:42:20 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" 20:42:20
>tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE" 20:42:20
>Connecting to 192.168.1.4 port 1433, TDS 7.0. 20:42:20 TDS7_send_login to
>192.168.1.4 port 1433, TDS 7.0.
>20:42:20 tds_put_string entered with S01060080c8f879e3 len=17 20:42:20
>tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string converting 17 bytes of "S01060080c8f879e3"
>20:42:20 tds_put_string wrote 34 bytes
>20:42:20 tds_put_string entered with sa len=2
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string converting 2 bytes of "sa"
>20:42:20 tds_put_string wrote 4 bytes
>20:42:20 tds_put_string entered with len=0
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string wrote 0 bytes
>20:42:20 tds_put_string entered with sqlhost len=7
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string converting 7 bytes of "sqlhost"
>20:42:20 tds_put_string wrote 14 bytes
>20:42:20 tds_put_string entered with len=0
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string wrote 0 bytes
>20:42:20 tds_put_string entered with us_english len=10
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string converting 10 bytes of "us_english"
>20:42:20 tds_put_string wrote 20 bytes
>20:42:20 tds_put_string entered with tessql len=6
>20:42:20 tds_put_string min bytes 1 max bytes 1
>20:42:20 tds_put_string converting 6 bytes of "tessql"
>20:42:20 tds_put_string wrote 12 bytes
>20:42:20 tds_process_login_tokens()
>Received header @ 20:42:20
>0000 04 01 01 94 00 00 00 00- |........|


>Received packet @ 20:42:20
>0000 e3 1b 00 01 06 74 00 65-00 73 00 73 00 71 00 6c |.....t.e .s.s.q.l|
>0010 00 06 6d 00 61 00 73 00-74 00 65 00 72 00 ab 60 |..m.a.s. t.e.r..`|
>0020 00 45 16 00 00 02 00 25-00 43 00 68 00 61 00 6e |.E.....% .C.h.a.n|
>0030 00 67 00 65 00 64 00 20-00 64 00 61 00 74 00 61 |.g.e.d. .d.a.t.a|
>0040 00 62 00 61 00 73 00 65-00 20 00 63 00 6f 00 6e |.b.a.s.e . .c.o.n|
>0050 00 74 00 65 00 78 00 74-00 20 00 74 00 6f 00 20 |.t.e.x.t . .t.o. |
>0060 00 27 00 74 00 65 00 73-00 73 00 71 00 6c 00 27 |.'.t.e.s .s.q.l.'|
>0070 00 2e 00 05 53 00 52 00-56 00 4e 00 54 00 00 00 |....S.R. V.N.T...|
>0080 00 e3 17 00 02 0a 75 00-73 00 5f 00 65 00 6e 00 |......u. s._.e.n.|
>0090 67 00 6c 00 69 00 73 00-68 00 00 ab 64 00 47 16 |g.l.i.s. h...d.G.|
>00a0 00 00 01 00 27 00 43 00-68 00 61 00 6e 00 67 00 |....'.C. h.a.n.g.|
>00b0 65 00 64 00 20 00 6c 00-61 00 6e 00 67 00 75 00 |e.d. .l. a.n.g.u.|
>00c0 61 00 67 00 65 00 20 00-73 00 65 00 74 00 74 00 |a.g.e. . s.e.t.t.|
>00d0 69 00 6e 00 67 00 20 00-74 00 6f 00 20 00 75 00 |i.n.g. . t.o. .u.|
>00e0 73 00 5f 00 65 00 6e 00-67 00 6c 00 69 00 73 00 |s._.e.n. g.l.i.s.|
>00f0 68 00 2e 00 05 53 00 52-00 56 00 4e 00 54 00 00 |h....S.R .V.N.T..|
>0100 00 00 e3 0f 00 03 05 69-00 73 00 6f 00 5f 00 31 |.......i .s.o._.1|
>0110 00 01 00 00 e3 0b 00 05-04 31 00 30 00 33 00 33 |........ .1.0.3.3|
>0120 00 00 e3 0f 00 06 06 31-00 39 00 36 00 36 00 30 |.......1 .9.6.6.0|
>0130 00 39 00 00 ad 36 00 01-07 00 00 00 16 4d 00 69 |.9...6.. .....M.i|
>0140 00 63 00 72 00 6f 00 73-00 6f 00 66 00 74 00 20 |.c.r.o.s .o.f.t. |
>0150 00 53 00 51 00 4c 00 20-00 53 00 65 00 72 00 76 |.S.Q.L. .S.e.r.v|
>0160 00 65 00 72 00 00 00 00-00 07 00 04 27 e3 13 00 |.e.r.... ....'...|
>0170 04 04 34 00 30 00 39 00-36 00 04 34 00 30 00 39 |..4.0.9. 6..4.0.9|
>0180 00 36 00 fd 00 00 00 00-00 00 00 00 |.6...... ....|



>In <0I6S00C03F6SZL@l-daemon>, on 11/06/04
> at 06:12 PM, lsunley AT mb.sympatico.ca said:

>>In <0I6S0061L832KI@l-daemon>, on 11/06/04
>> at 05:59 PM, lsunley AT mb.sympatico.ca said:

>>>In <20041106185815.3a3cd0c1.jklowden AT schemamania.org>, on 11/06/04
>>> at 06:58 PM, "James K. Lowden" <jklowden AT schemamania.org> said:

>>>>lsunley AT mb.sympatico.ca wrote:
>>>>> >The issue, we know: the ODBC driver does not set the servername field
>>>>> >of the login packet before connecting. It should call tds_set_server()
>>>>> >when it discovers the servername, although it's not clear what "server
>>>>> >name" means when freetds.conf isn't used.

>>>>> Is the servername supposed to be the resolved host name of the server?

>>>>No. The "servername" in this case is a field passed to the server in the
>>>>login packet. It's the dataserver name, the [servername] in the
>>>>freetds.conf file, the name the client application uses to open a
>>>>connection.

>>>>Most servers ignore it, afaik. ASA requires it, because it uses it as
>>>>the name of the database to "start".

>>>>The ct-lib and db-lib libraries fill the field correctly; the ODBC driver
>>>>stuffs in 'SYBASE' instead. That be the problem.

>>>>Hope that's clear. :-)

>>>Yes,

>>>I'll take a quick look at the ODBC code, it should be really simple to
>>>put in an additional key in the odbc.ini for that value and pass it along
>>>to the right spot.

>>>Lorne



>>This code appears to set that

>>from connectparams.c

>>The "server_name" field loaded with the ODBC key "Server" is the
>>TDSCONNECT structure "server_name" (first one in the struct )


>>I think if you do not have "Servername" in the ODBC.INI and have "Server"
>>set to the appropriate name the connection should work

>>"Address" is the IP address or host name of the server

>>Lorne

>>odbc_get_dsn_info(const char *DSN, TDSCONNECTINFO * connect_info) {
>> char tmp[FILENAME_MAX];
>> int freetds_conf_less = 1;
>> int address_specified = 0;
>> /* use old servername */
>> tmp[0] = '\0';
>> if (SQLGetPrivateProfileString(DSN, "Servername", "", tmp,
>> FILENAME_MAX,
>>"odbc.ini") > 0) {
>> freetds_conf_less = 0;
>> tds_read_conf_file(connect_info, tmp);
>> }
>> /* search for server (compatible with ms one) */
>> if (freetds_conf_less) {
>> tmp[0] = '\0';
>> if (SQLGetPrivateProfileString(DSN, "Address", "", tmp,
>> FILENAME_MAX,
>>"odbc.ini") > 0) {
>> address_specified = 1;
>> /* TODO parse like MS */
>> tds_lookup_host(tmp, tmp);
>> tds_dstr_copy(&connect_info->ip_addr, tmp);
>> }
>> tmp[0] = '\0';
>> if (SQLGetPrivateProfileString(DSN, "Server", "", tmp,
>> FILENAME_MAX,
>>"odbc.ini") > 0) {
>> tds_dstr_copy(&connect_info->server_name, tmp);
>> if (!address_specified) {
>>
>> tds_lookup_host(tds_dstr_cstr(&connect_info->server_name), tmp);
>> tds_dstr_copy(&connect_info->ip_addr, tmp);
>> }
>> }
>> }







--
-----------------------------------------------------------
lsunley AT mb.sympatico.ca
-----------------------------------------------------------





Archive powered by MHonArc 2.6.24.

Top of Page