Skip to content

FreeTDS Configuration and Use

FreeTDS is an application that is installed with Assure1 and allows components and rules files to connect to databases besides MySQL. This can then be used with the Generic Database Aggregator, Generic Database Connector or other applications that connect to a database to retrieve data. This GUIDE includes the steps needed to utilize FreeTDS as well as the known configurations that will work with Assure1 and an external database.

Notes

  • FreeTDS is not a Assure1 component and is not created or maintained by Federos.

  • Connection settings for other databases not listed here will need to be found and tested.

  • Each (DATA_SOURCE_NAME) must be unique within the freetds.conf file. Ensure duplicates are not being created when adding to or editing the file.

Dependencies

  • The Vendor Free TDS Application and Vendor Free TDS Configuration packages should be installed on any server that will be using FreeTDS.

Configure FreeTDS

  1. Update the freetds.conf file. One of the Known Configurations below may be used, or the specific settings needed for a particular database.

  2. Update the Assure1 Component or the Rules files to use the new configuration settings.

    • Usage example within a Assure1 Component for the Generic Database Aggregator or Generic Database Connector

      • DSN - dbi:Sybase:server=(DATA_SOURCE_NAME)

      • Password - (DATABASE_PASSWORD)

      • Username - (DATABASE_USERNAME)

    • Example usage within a Assure1 Rules File:

    my $UserName  = '(DATABASE_USERNAME)'; 
    my $Password  = '(DATABASE_PASSWORD)'; 
    my $DBH       = DBI->connect('dbi:Sybase:server=(DATA_SOURCE_NAME)', $UserName, $Password, {PrintError=>1}) or die "unable to connect to server " . $DBI::errstr; 
    my $Query     = '(SQL_QUERY)'; 
    my $STH       = $DBH->prepare($Query) or die "prepare failed for query $Query\n"; 
    $STH->execute() or die "unable to execute query $Query :: error $DBI::errstr"; 
    while (my $row = $STH->fetchrow_hashref()) { 
        (CODE TO PROCESS THE RESULTS GOES HERE) 
    }
    

Known Configurations

Microsoft SQL Server 2000

Here are the freetds.conf configuration settings for a Microsoft SQL 2000 server.

[MyServer2k]
    host        = (DATABASE_SERVER)
    port        = 1433
    tds version = 8.0

Microsoft SQL 2005

Here are the freetds.conf configuration settings for a Microsoft SQL 2005 server.

Note: instance may not be needed in all situations, dependent upon your individual database configuration.

[(DATA_SOURCE_NAME)]
    host        = (DATABASE_SERVER)
    instance    = (INSTANCE_NAME)
    port        = (PORT)
    tds version = 7.0

Example Usage

Here are the freetds.conf settings to connect to a SolarWinds database, which runs on a Microsoft SQL 2005 Server:

[solarwinds]
    host        = solarwinds.(YOUR_DOMAIN).com
    instance    = SOLARWINDS_ORION
    port        = 1433
    tds version = 7.0

Here are the Assure1 component settings to connect to the SolarWinds database using the settings in the freetds.conf file:

  • DSN - dbi:Sybase:server=solarwinds

  • Password - (YOUR_PASSWORD)

  • Username - SolarWindsOrionDatabaseUser

Microsoft SQL Server 6.x Configuration

Here are the freetds.conf configuration settings for a Microsoft SQL 6.x server.

[MyServer65]
    host        = (DATABASE_SERVER)
    port        = 1433
    tds version = 4.2

Microsoft SQL Server 7.x

Here are the freetds.conf configuration settings for a Microsoft SQL 7.x server.

[MyServer70]
    host        = (DATABASE_SERVER)
    port        = 1433
    tds version = 7.0

Nimbus

Here are the freetds.conf configuration settings for a Nimbus server.

[NimBUS]
    host        = (DATABASE_SERVER)
    port        = 1433
    tds version = 8.0