Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

SQL Server 2000 DBI Authentication

by tux402 (Acolyte)
on Aug 06, 2009 at 19:36 UTC ( [id://786553]=perlquestion: print w/replies, xml ) Need Help??

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

Greetings Monks,

I have previously used the FreeTDS driver to connect Perl to a MS Sql server using domain, and sql server authentication. I am trying to connect to a different sql 2000 server, but the only authentication method I can use is Windows Authentication. SQL authentication is out of the question. This is my previous dsn for reference.
my $dsn = "DRIVER=/usr/local/lib/libtdsodbc.so;SERVER=$host;DATABASE=$ +db;PORT=4433;UID=$usr;PWD=$pw;TDS_Version=8.0;"; my $dbh = DBI->connect('DBI:ODBC:'.$dsn) || die $DBI::errstr;
Does anyone know of a way to connect to this SQL server using Windows authentication only?

Replies are listed 'Best First'.
Re: SQL Server 2000 DBI Authentication
by Narveson (Chaplain) on Aug 06, 2009 at 20:49 UTC

    Looks like you're connecting with ODBC. An ODBC connect string is a list of name-value pairs. For Windows authentication, omit UID=$usr;PWD=$pw; and instead say Trusted_Connection=Yes;.

    For comparison, here's a code snippet I use to connect to SQL Server databases using DBI::ODBC. You may want to keep your value for DRIVER.

    my $connect_string = 'DRIVER={SQL Server};' . "SERVER=$server;" . 'Trusted_Connection=Yes;' ; my $dbh = DBI->connect( "dbi:ODBC:$connect_string", undef, undef, { RaiseError => 1 }, );

Re: SQL Server 2000 DBI Authentication
by vladdrak (Monk) on Aug 06, 2009 at 23:12 UTC
    If you're connecting from a unix host via FreeTDS then Integrated Auth isn't going to be a viable option.

      I don't use freeTDS but I thought it supported integrated security by passing the domain\username in the username field http://www.freetds.org/faq.html#integratedsecurity

      There are commercial SQL Server ODBC drivers which support integrated security from UNIX.

      There are other ways of connecting from UNIX to MS SQL Server using ODBC and Windows authentication if you can install something on A windows machine (it does not have to be the SQL Server machine). You can use an ODBC-ODBC Bridge which installs a server process on a Windows machine which uses the MS SQL Server Driver to talk to SQL Server. An ODBC driver is installed at the client end which talks to the bridge server and on to SQL Server. Of course the only ones I know of are commercial ones from Easysoft and Openlink.

        Yeah, It doesn't seem like what I need is possible. The problem is that the sql server is going into production tomorrow, and my bosses are very apprehensive about installing 3rd party drivers (even if they are from trusted sources.) It seems to me that my only real option is to either set up replication, or do a sql dump onto a secure file share; unless anyone else has other ideas.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://786553]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found