[freetds] SQL Cluster always on

esterniclos at gmail.com esterniclos at gmail.com
Thu Jan 7 04:31:46 EST 2016

Hello everyone,

We would like to adapt freetds to SQL Server Always On Clustering.

This kind of cluster is pretty simple: 

        Every database has associated a Listener with a dns name. E.g.
        Every listener has 2 or more IPs associated:
        nslookup dblistener.myorg.com responds something like:

        Only one of the IP's serves the database (active-passive)

        The connection has to be made directly to the listener. and use
the IP that is working at that moment.

TDS Behaviour at this point.

    Right now, TDS works as long as the listener is in the first node.
In the example
                 dblistener.myorg.com   instance working in

    If the database is moved to another instance, it returns a timeout.
Never checks the rest of IPs

Possible solution

        Try to login in several times with as many objects as IP's are
in DNS:

                        tds/login.c:tds_set_host(TDSLOGIN * tds_login,
const char *hostname)

          This would penalize a little when the database is in the
backup instance, as it has to receive a timeout before making the
          To speed up things, the last IP where the database was seen
could be also stored, and only ask dns if there is a time out.

Thank you for your time, and any advice is welcome.

               Ester Niclós Ferreras

More information about the FreeTDS mailing list