[freetds] connecting to two databases with the same name but ondifferent servers

Reid, Roger L. roger.reid at dpw.com
Fri Jul 20 15:54:12 EDT 2007

The stuff between the [] is a server alias, not a database name.  

Now, if you have a one database server, and you call the server and database the same thing that might not be obvious.

It would help to know what doesn't work, what error, whatever.   But your 2 servers are [rmengDb] and [rmengDb2].

If you're database is called rmengDb on both boxes, that's what you'll want to specify for the DATABASE.

In my shop we always do an explict "use <database>" call....I think it can be on the connection string like this


but I havn't used it in a while: check the CPAN page on DBI and you should be OK.   Just remember that the config
entry is the dataserver, not the database.


-----Original Message-----
From: Chris Brookes [mailto:cbrookes at gmail.com] 
Sent: Thursday, July 19, 2007 4:12 PM
To: freetds at lists.ibiblio.org
Subject: [freetds] connecting to two databases with the same name but ondifferent servers

I'm using freetds-0.62.4 on Solaris to access a SQL Anywhere database
(ciscoworks) from perl using DBD-Sybase=1.08. It works great. My
freetds.conf entry is:

        host = server.domain.com
        port = 43455
        tds version = 5.0

My connect string in perl:

$cw = DBI->connect("DBI:Sybase:rmengDb", $user, $passwd)

I have another Ciscoworks box that I need to access from the same
script, so I configure another entry like this:

        host = server2.domain.com
        port = 43455
        tds version = 5.0

But this doesn't work when I called Sybase:rmengDb2 from a connect in
perl. I think I remember reading somewhere originally that the name in
[] is used as the database to connect to? I can't have the same
definition [] twice in the freetds.conf, so where does that leave me?

It seems like there is a ;database=whatever parameter you can add to
the DBI connect string but I can't seem to get it to work.

Is there a solution for this?

Any help appreciated


More information about the FreeTDS mailing list