Re: issue with connecting ms sql azure
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi Andy, On Fri, 30 Sep 2011 16:32:32 -0700 Andy Qian <[email protected]> wrote: > I have modified struct imp_dbh_st in dbdimp.h > (DBD::Sybase level) by adding one more field there, int directConn, > and also updated dbdimp.c file correspondingly. Rather than an int, I suggest "char *dbname". If the dbname appears in the connection string, you stash it there, else it's NULL and behavior reverts to the current form: no dbname in the login packet. > at freetds level, I may need to modify struct CS_CONNECTION Luckily, no! :-) CS_CONNECTION is a struct _cs_connection, which contains a TDSLOGIN *tds_login, which has DSTR database. If you set that before connecting to the server, it will be available to be included in the login packet. The function you want to extend appears to be ct_con_props(). You'll need to add a new enumeration, let's call it "CS_DBNAME", to the anonymous enum that starts with CS_USERNAME in cspublic.h. Add that to the switches in ct_con_props() and call tds_set_database_name(). Just eyeballing the code, that looks to be all that's needed. The libtds login function will include the dbname in the login packet. HTH. --jkl