Skip to Content.
Sympa Menu

freetds - Re: [freetds] Sybase ASA 9, unixODBC multiple connection problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Sybase ASA 9, unixODBC multiple connection problem
  • Date: Wed, 16 Jan 2008 18:44:23 -0500

Middleton, Eric wrote:
> They are Sybase version 9 and it seems in the odbc.ini that if the
> server name in the config is not the name of the actual database file
> then the connection does not work. Well this is a problem because all 9
> servers have a database that is the same. So the only difference is the
> IP. However since the ip is in the freeTDS.conf file then I can only
> connect to the first server in the .conf file. Does anyone know a work
> around for this?

You, my friend, need a patch. Badly, eight times over. :-(

What happens: FreeTDS puts the [servername] text in the login packet, in a
field the TDS 5.0 functional spec calls "lservname". For every other kind
of TDS server, the field is a user-defined string with no inherent meaning
to the server. For ASA servers, it identifies the database. That works
as long as you don't have two servers with the same database.

Good news: You don't have two such servers
Bad news: You have nine.

What's needed: a freetds.conf server attribute that overrides the above
behavior:

[fruitserver1]
...
ASA Database = bananas

and a change to src/tds/config.c to use that field instead of the
servername in the login packet.

As a quick hack, I did something simpler, attached. Apply it, recompile,
relink, reinstall. Set the environment variable "ASA_DATABASE" to the
name of your database. The login packet will use that string instead of
[servername] for lservname. If you use it, please let me know if it
works.

Setting TDSHOST might also work if you can set the environment before each
connection. The effect would be to look up the same "server" every time,
but to override the connection target, keeping the other attributes the
same, obviously. Two points for using the mailing list, where you can
snare suggestions from everyone, and a bonus for coming up with just the
kind of hack I'd never think of.

Regards,

--jkl

Attachment: asa_database.diff
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page