tjewkes67 has asked for the wisdom of the Perl Monks concerning the following question:

hello, after searching for over a week i almost found what i was looking for here:

How do I create/remove ODBC DSN entries under Windows (Win32)? (the second example)

however, this script creates the dsn using sql server authentication. what i need is windows authentication. i'm really new and i don't know what needs to be altered to get it to work. thanks for your help

20060907 Janitored by Corion: Added formatting, linkified link, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: create ODBC DSN entries in Windows
by Asim (Hermit) on Sep 06, 2006 at 19:54 UTC
    this script creates the dsn using sql server authentication. what i need is windows authentication.

    Unless I'm wrong, the "SQL Server" refered to in:

    my $result = Win32::ODBC::ConfigDSN( ODBC_ADD_DSN, "SQL Server", ## this last is the driver name ( ##options "DSN=$dsn", ## DSN identifier "NETWORK=DBMSSOCN", ## use TCP/IP library "SERVER=test_server", ## server name "DATABASE=test_db", ## database name "DESCRIPTION=My test DSN" ) ); ## end of ConfigDSN call
    is a reference to the driver, NOT the authentification; it says as much in the code, itself. The authentification for who's allowed to create the DSN is based on, basically, the login that runs the program.

    ----Asim, known to some as Woodrow.

Re: create ODBC DSN entries in Windows
by NetWallah (Canon) on Sep 07, 2006 at 00:04 UTC
    Try
    "NETWORK=dbnmpntw", ## use Named Pipes
    The other option, "DBMSSOCN" uses TCP/IP sockets, which do not go through Windows security for communication. Named pipes DO.

         "For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken

Re: create ODBC DSN entries in Windows
by gellyfish (Monsignor) on Sep 07, 2006 at 11:03 UTC

    I think you want the Integrated Security attribute to your attributes list i.e something like:

    "Integrated Security=SSPI"
    in the options.

    /J\