Re: setting the default database ("asa database")
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <CAHt6W4eaCkjX7oY61ygb4WOELFpkwYddUJY4_EXr1AsnNJRQiQ@mail.gmail.com> |
2015-03-10 13:43 GMT+00:00 <[email protected]>: > Hi Frediano, > > Please find the requested details below. > > > Context: > 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: > [FOOBAR_DEV] > 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. > > Solution: > 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 > 252c252 > < 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. > > Thanks, > Subhendu > Unfortunately in this case documentation is not really clear as "database" terminology is used with two different meaning. ASA wants mainly that the server name in the login packet being the same as the one used during installation. So the "asa database" option replace server_name used to build login packet. Usually to set database field in the login structure you use different options provided by upper layer libraries. Frediano