Skip to Content.
Sympa Menu

freetds - Re: [freetds] Using DBLIB With Azure

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ken Collins <ken AT metaskills.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Using DBLIB With Azure
  • Date: Thu, 10 Mar 2011 22:37:34 -0500


>> So I am testing TinyTDS with Azure and I am close. I have 0.83.dev
>> installed with OpenSSL and can connect with tsql.
>>
>> $ tsql -S azure -U tinytds@abc -P password -D tinytdstest
>>
>> But I am having an issue with figuring out a way to use a database
>> setting. I know that Azure does not have a notion of "USE ..." or has a
>> way to specify a default database with the user account, so I was let with
>> reverse engineering how tsql accomplishes a connection using the -D option
>> and I am left stumped as to how I can get TDSCONNECTION's database string
>> in there. FYI, TinyTDS only uses sybdb.h and sqlfront.h, so some things
>> that tsql is doing is not a public API. Perhaps there is something that
>> can be done for this?
>
> In src/apps/tsql.c, look for opt_default_db.
> The TDS 7+ login packet has a default database field, cf. doc/tds.html.
> The db-lib dbuse() function just sends "USE dbname" to the server.


68 INT16 position of database name
70 INT16 database name length
...
86 UCS2LE[n] hostname
...
UCS2LE[n] database name

Very informative!

I am still not seeing a way that I can use this. TinyTDS compiles against
sqlfront.h and sybdb.h. Is there a way that the name can be set in this
packet when I am using the DBLIB api like in the LOGINREC or something? Maybe
with this? #define DBSETLPACKET(x,y) dbsetllong((x), (y), DBSETPACKET) A
bit more guidance would really be helpful.

Also, would it be considered a bug that the database name is not pulled from
the freetds.conf would be a bug. Like in the tsql example above, if I left
off the -D option was left off and there was a database specified in the
conf? If so, this would be another way to accomplish it because if that
worked, then the conf would maybe work for me too. Thanks so much ahead of
time for any help.

- Ken









Archive powered by MHonArc 2.6.24.

Top of Page