The locales.conf file

What it does

For an English-speaking American, not much. FreeTDS originated in the United States, and uses U.S. conventions if no locales.conf is present. The locales.conf provided with the installation also reflects these conventions.

Information on locales and locale strings is easily (even too easily!) found on the Internet, or see man locale for your system. FreeTDS will examine its environment for a LOCALE string. If it finds one, it will look it up in locales.conf to find your preferred settings. If it fails to find one, it will use its defaults.

locales.conf controls three settings:

Date format

The way dates will appear when implicitly converted to strings by FreeTDS.

language

The language that will be used for error/status messages from the server. A SQL Server client can specify a language for such messages at login time.

Note: FreeTDS issues a few messages of its own. Messages from the server are called "messages"; those from the client library (i.e., from FreeTDS) are called "error messages". FreeTDS-issued messages are not affected by locales.conf.

character set

Indicates to the server what character set should be used for communicating with the client.

Where it goes

Like freetds.conf, the location of locales.conf is determined by the value of --sysconfdir in configure. The default is PREFIX/etc.

What it looks like

The format of locales.conf is similar to that of freetds.conf. There is a [default] section, and a section for each locale. locales.conf controls three settings

date format

This entry will be passed (almost) literally to strftime(3) to convert dates to strings.

For the most part, see you system documentation for strftime(3) (man 3 strftime). You will see there though that strftime(3) has no provision for milliseconds. The locales.conf format string uses %z for milliseconds.

Note: If your system's strftime(3) does employ %z for its own use, it will not be given that chance by FreeTDS. FreeTDS will consume the %z for its milliseconds needs, and will not pass it on to strftime(3).

language

The language that will be used for error/status messages from the server. A SQL Server client can specify a language for such messages at login time.

Note: FreeTDS issues a few messages of its own. Messages from the server are called "messages"; those from the client library (i.e., from FreeTDS) are called "error messages". FreeTDS-issued messages are not affected by locales.conf.

character set

Indicates to the server what character set should be used for communicating with the client.