Connection attributes
Prev | Chapter 4. Preparing ODBC | Next

## Connection attributes

The following tables define all possible ODBC connection attributes for the FreeTDS ODBC driver. Which ones you'll need depends on how you set yourself up. They may appear in your connection string, or in `odbc.ini`.

Table 4.1. Connection attributes used only in connection strings

Name | Possible Values | Default | Meaning
--- | --- | --- | ---
`DSN` | A valid DSN entry | none | The `DSN` to which FreeTDS should connect. FreeTDS will search `odbc.ini` for entry. It lets you specify a connection as for `SQLConnect`, but using `SQLDriverConnect`. Do not use `Servername` and `DSN` together.
`UID` | Any valid username | none | The username to be used when connecting. To use domain authentication, specify the domain using the format `domain\username`.
`PWD` | Any | empty | The password to be used when connecting.
`WSID` | Any | Computer name | The name of the local computer, sent to server. Can be specified only for a DSN-less connection.

Table 4.2. Connection attributes that may appear in `odbc.ini`

Name | Possible Values | Default | Meaning
--- | --- | --- | ---
`Servername` | A valid `freetds.conf` server section | none | A `freetds.conf` servername, not a hostname as known to DNS. If you want to use ODBC-only configuration, use `Server` instead.
`Server` | A server name or (ip) address | none | Hostname of a server. Used in an ODBC-only configuration. To specify a Microsoft SQL Server instance, use the form `server\instance`.
`Port` | Any TCP port | Depends on the TDS version specified with configure | The TCP port where the servername is listening.
`TDS_Version` | Any valid protocol version | Depends on the TDS version specified with configure | TDS protocol version to use (e.g., 5.0, 7.0).
`ClientCharset` or `Client_Charset` | A name recognized by the iconv library linked to FreeTDS. Corresponds to `client charset` in `freetds.conf`. `Client_Charset` is for compatibility with NCBI C++ ToolKit. | ISO 8859-1 | Character set (encoding) used by the client.
`APP` | Free form text, up to 30 characters. | none | Application name. Identifies the connecting application to the server.
`Language` | Any | us_english | (Human) language the server should use for error messages.
`Address` | Any | none | IP address of the servername. Useful if you want to specify a server by address, rather than by name. The format is `ip,port` or simply `ip` in standard dotted-decimal notation.
`Database` | Any | none | Specify which database you want to access. If the database does not exist or the user lacks permission to access it, the connection will fail.
`TextSize` | Any | Server-dependent | Maximum size returned from server for blobs.
`PacketSize` | Any | Server-dependent | Size of packets to server. Some users saw some performance gain by increasing this value. Normally you shouldn't set it.
`Trusted_Connection` | Yes/No | No | Use your current account instead of `UID`/`PWD` attributes. This option require SSPI or Kerberos and supersedes any `UID`/`PWD` attributes passed from the application.
`Encryption` | off/request/require | off | Specify encryption. See encryption on `freetds.conf`
`MARS_Connection` | Yes/No | No | Enable MARS for this connection.
`UseNTLMv2` | Yes/No | Yes | Use NTLMv2 instead of normal NTLM. Use this option if your Windows domain have this setting.
`REALM` | Machine domain | none | Kerberos REALM.
`ServerSPN` | Any valid SPN | MSSQLSvc/server FQDN:port | Full server Kerberos SPN.
`AttachDbFilename` | server filename (mdf/sdf) | none | MSSQL allow to attach a database while connecting to a server. This setting allow to do it. You should specify `Database` attribute to set the name of the database that will be used.
`DumpFile` | Any |  | File name where to dump logs.
`DumpFileAppend` | Yes/No | No |
`DumpFlags` | Any |  | Debug flags. See freetds.conf entries.
`ApplicationIntent` | ReadWrite/ReadOnly | ReadWrite | Tell application intent. See `read-only intent` on freetds.conf.
`Timeout` | Integer number |  | Query timeout in seconds.

Prev | Up | Next
Chapter 4. Preparing ODBC | Home | DSN-less configuration