Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to connect via windows authentication?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Velichko Yuriy <velichko.yuriy AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to connect via windows authentication?
  • Date: Sat, 14 Mar 2015 01:06:06 +0200

A little question about Windows SSPI auth.
My app uses db-lib. The SQL server and app works on the same machine (win
8.1, SQLServer EXPRESS 12)

conf file:

host = localhost
port = 1433
connect timeout = 0
tds version =
​7​
.0
use ntlmv2 = yes
client charset = UTF-8

​Code to connect:​

dberrhandle( ...);
dbmsghandle( ... );

DBSETLUSER( login, "" );
DBSETLPWD( login,"" );

DBPROCESS* conn = dbopen( login, my_app" );
if( conn )
{

}
else
{
<<<< Goes here
}




On 13 March 2015 at 17:03, Velichko Yuriy <velichko.yuriy AT gmail.com> wrote:

> Thanks!
>
> The first approach works fine. I saw it before but forgot to duplicate '\'
> symbol in the user name, so got an error, very shamefully. )
>
> Second approach needs more time to realisation but I'm sure that I can
> implement it too.
>
> Thanks for the quick answer. Very helpful.
>
> On 13 March 2015 at 16:46, Frediano Ziglio <freddy77 AT gmail.com> wrote:
>
>> 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() ?
>>
>> Hi,
>> 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
>> documentation).
>>
>> 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.
>>
>> Regards,
>> Frediano
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS AT lists.ibiblio.org
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>
>
>
>
> --
> ​С уважением, Величко Юрий.
>



--
​С уважением, Величко Юрий.




Archive powered by MHonArc 2.6.24.

Top of Page