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 18:12:11 -0500

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