# [freetds] Sybase ASA 7, unixODBC problem

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Mon Nov 8 03:27:17 EST 2004

```> >
> > When I was digging through the code...
> >
> > You can set the environment variable DSQUERY to the server
> name and that
> > will be used by tds_set_server
>
> Well, I'll be.
>
> I can't say that this has much to recommend it (apart from
> the fact that
> it works, if by accident).  We really ought to pick up the
> servername from
> the freetds.conf file.  Or maybe from odbc.ini or the
> connection string.
> But at least it's a workaround.
>
> Thanks for the legwork, Lorne.
>

I don't like DSQUERY/TDSQUERY method (not threadsafe). Some extracts
from an old mail I found:

L J Bayuk:
> James K. Lowden wrote:
> >
> > > while the server name is part of the "app
> > > name" specification of the sybase_connect() function of PHP.  I
don't
> > > think such an option exists for SQSH/TSQL, but perhaps it would be
> > > beneficial to include it?
> >
> > Maybe.  I just spent a little while looking for where we pick up the
> > servername and send it to the server (as app_name or the database
name).
> > I didn't find it.  I would be nice to rid FreeTDS of this particular
quirk
> > if we can.
>
> Another consequence of this quirk is that it isn't possible to
configure
> FreeTDS to allow connections to two same-named ASA databases on
different
> servers. Nor can I configure two connections to the same server and
> database but with different options, like one with debug logging and
one
> without.
>
> What seems to be needed is a freetds.conf parameter called "database
name"
> which can be set independent of what the user guide calls "dataserver
> name". Then you could have different "dataserver names" in
freetds.conf
> which send the same database name field in the TDS login packet.

James K. Lowden:
> So, Ben, just so I'm sure I understand:  For a connection to ASA to
work,
> the [servername] entry of freetds.conf has to match the server's
database
> name.  The server evidently compares the server_name field of the TDS
5.0
> login packet to its database name, and rejects the login if they don't
>
> You'd like an override.  You'd like to control the value of the
server_name
> field  in the freetds.conf entry, in some way besides the [servername]
> entry.
>
> We'll have to invent a reasonable name for it.  I think "database
name" is
> misleading unless we also send a "use <databasename>" command
immediately
> after logging on.  I think "servername" is confusing.  Perhaps "ASA
> Servername" is better.
>
> Nes pas?

Checking ODBC code I saw that server_name was not set up correctly.
Fixed in CVS. However ASA problem still remains...
Can an ASA server have multiple databases ? Is this "ASA Servername"
something like Microsoft server "instance" ?
I know I can configure multiple server using different ports on the same
host.
Someone to fix the problem used Server and Address in ODBC DSN however