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

NamePossible ValuesDefaultMeaning
DSNA valid DSN entrynoneThe 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.
UIDAny valid usernamenoneThe username to be used when connecting. To use domain authentication, specify the domain using the format domain\username.
PWDAnyemptyThe password to be used when connecting.
WSIDAnyComputer nameThe 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

NamePossible ValuesDefaultMeaning
ServernameA valid freetds.conf server sectionnoneA freetds.conf servername, not a hostname as known to DNS. If you want to use ODBC-only configuration, use Server instead.
ServerA server name or (ip) addressnoneHostname of a server. Used in an ODBC-only configuration. To specify a Microsoft SQL Server instance, use the form server\instance.
PortAny TCP portDepends on the TDS version specified with configureThe TCP port where the servername is listening.
TDS_VersionAny valid protocol versionDepends on the TDS version specified with configureTDS protocol version to use (e.g., 5.0, 7.0).
ClientCharset or Client_CharsetA 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-1Character set (encoding) used by the client.
APPFree form text, up to 30 characters. noneApplication name. Identifies the connecting application to the server.
LanguageAnyus_english(Human) language the server should use for error messages.
AddressAnynoneIP 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.
DatabaseAnynoneSpecify which database you want to access. If the database does not exist or the user lacks permission to access it, the connection will fail.
TextSizeAnyServer-dependentMaximum size returned from server for blobs.
PacketSizeAnyServer-dependentSize of packets to server. Some users saw some performance gain by increasing this value. Normally you shouldn't set it.
Trusted_ConnectionYes/NoNoUse your current account instead of UID/PWD attributes. This option require SSPI or Kerberos and supersedes any UID/PWD attributes passed from the application.
Encryptionoff/request/requireoffSpecify encryption. See encryption on freetds.conf
MARS_ConnectionYes/NoNoEnable MARS for this connection.
UseNTLMv2Yes/NoYesUse NTLMv2 instead of normal NTLM. Use this option if your Windows domain have this setting.
REALMMachine domainnoneKerberos REALM.
ServerSPNAny valid SPNMSSQLSvc/server FQDN:portFull server Kerberos SPN.
AttachDbFilenameserver filename (mdf/sdf)noneMSSQL 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.
DumpFileAny File name where to dump logs.
DumpFileAppendYes/NoNo 
DumpFlagsAny Debug flags. See freetds.conf entries.
ApplicationIntentReadWrite/ReadOnlyReadWriteTell application intent. See read-only intent on freetds.conf.
TimeoutInteger number Query timeout in seconds.