[freetds] setting the default database ("asa database")

subhendu.ray at barclays.com subhendu.ray at barclays.com
Tue Mar 10 09:43:43 EDT 2015

Hi Frediano,

Please find the requested details below.

As per the freetds.conf<http://www.freetds.org/userguide/freetdsconf.htm> documentation, 'ASA database' should set up the default database when connected to the database server instance.
ASA database    valid database name     servername [section] name       Specifies the name of the default database when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers, lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that lservname contain a valid database name, and sets that as the default database for the connection. FreeTDS normally fills lservname with the [section] text.. This entry instead sets the database name independently of the [section] name.

Example of the freetds.conf:
    host = db_at_foo.fqdn.com
    instance = FOO_DEV_INSTANCE
    tds version = 7.0
    asa database = BAR

Problem: The default database was not set correctly when connected to "FOOBAR_DEV" DSN.

Left file: src\tds\config#2.c
Right file: src\tds\config#3.c
                     } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) {
<                             tds_dstr_copy(&connection->server_name, value);
                           } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) {
>                             tds_dstr_copy(&connection->database, value);

There is another minor change suggested to make it obvious how we obtained the database during the setup phase; this is purely cosmetic. This can be ignored, if you like.
Left file: src\tds\config#2.c
Right file: src\tds\config#3.c
<                             tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "database", tds_dstr_cstr(&connection->database));
>                             tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "asa database", tds_dstr_cstr(&connection->database));

Please let me know if you need any more details.



This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.

For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.


More information about the FreeTDS mailing list