[freetds] How to connect via windows authentication?

Frediano Ziglio freddy77 at gmail.com
Fri Mar 13 10:46:45 EDT 2015

2015-03-13 14:09 GMT+00:00 Velichko Yuriy <velichko.yuriy at gmail.com>:
> Hello!
> I can't figure out how to connect to SQL Server via windows auth using
> fretds library (dblib).
> In examples is shown how to connect via the SQL authentication.
> Is there example for windows auth.
> Should I change conf file, or set specific info to the LOGINREC for
> dbopen() ?

  there are two way. Use domain username/password or use single sign on.

To use domain username/password just specify the domain in your
username. Something like "DOMAIN_NAME\\user_name" with your domain
password. Could be that you have to use ntlm version 2 (see

The other option is to use Kerberos or on Windows SSPI. The trick is
to specify empty strings for username and password. SSPI is used (and
available) on Windows and will use your logged on user while on any
other machine you have to setup Kerberos and login (kinit usually)
before launching your dblib application.


More information about the FreeTDS mailing list