Re: Using DBLIB With Azure

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Tue, 22 Mar 2011 07:15:56 -0400
Ken Collins <[email protected]> wrote:

> >> Azure does not have a notion of "USE ..." or has a way to specify a default database with the user account
> > 
> > https://github.com/rails-sqlserver/tiny_tds
> > 
> > OK, I think I finally get the picture.  
> > If I understand aright, the TinyTds user -- an elf or gnome, perhaps? -- should be able to say something like this:
> >
> > client = TinyTds::Client.new(:username => 'sa', :password => 'secret', :dataserver => 'mytds_box', :database = 'mydb')
...
> > You're not obliged to use only one db-lib function when the connection is established.  Just call dblogin(), dbopen(), and dbuse(), in that order.  Job done.  
> 
> Job not done. I have used dblogin(), dbopen() and dbuse() in that order since TinyTDS started.
...
> That process is exactly the problem. Like I said, Azure does not have a notion of "USE..." and that is what dbuse() does.

Exactly what problem, exactly?  

Why does it matter whether or not Azure has "a notion of" USE?  How does making one extra call to the library after opening the connection make any difference at all?   

Can the client specify the database to use as part of the connection command, as I indicated above, or not?  If so, why can't you call dbuse() after calling dbopen() and before returning to the caller?  

Somehow, sooner or later, the client has to indicate which database he wants to use.  That's when you call dbuse().  You don't have to modify the underlying library or alter the login packet just to write wrapper code.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.