Skip to Content.
Sympa Menu

freetds - Re: [freetds] issue with connecting ms sql azure

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andy Qian <andyq AT intapp.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] issue with connecting ms sql azure
  • Date: Mon, 3 Oct 2011 18:03:23 -0700

Hi, James,

thank you very much for your suggestions. They are really helpful.

I modified both sybase and freetds codes as you suggested, and tested them. It worked. Now I can connect to azure server with modified sybase and freetds. I also tested with other versions of ms sql server. so far so good.

for curiosity, is there any specific reason why the previous versions of sybase/freetds do not use the direct connection approach? or is there any risk for using the direct-connection approach?


thanks again.



Andy









On 10/01/2011 07:26 AM, James K. Lowden wrote:
Hi Andy,

On Fri, 30 Sep 2011 16:32:32 -0700
Andy Qian<andyq AT intapp.com> 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
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page