Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

DBI and FreeTDS Named Instances

by tux402 (Acolyte)
on Aug 10, 2009 at 22:30 UTC ( #787424=perlquestion: print w/replies, xml ) Need Help??
tux402 has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

I am having quite a hard time with this problem. I'm trying to connect to a MS sql server 2000 using FreeTDS and DBI. The trick is that I can only use NT Authentication, and I have to connect to a sql named instance. I can connect from Windows if I create the Windows user on my box, then use SQL Server Management Studio 2005, but not from Perl's DBI. Here is my dsn for reference. I and am not connecting locally.
#!/usr/bin/perl use DBI; my $host = '127.0.0.1\InstanceName'; my $usr = 'HostName\UserName'; my $pw = 'Password'; my $dsn = DRIVER=/usr/local/lib/libtdsodbc.so;SERVER=$host;PORT=4433;D +ATABASE=dataBase;UID=$usr;PW=$pw;TDS_Version=8.0"; my $dbh = DBI->connect('DBI:ODBC:'.$dsn) || die $DBI::errstr;

I keep getting the error

[FreeTDS][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

I'm not sure what is going wrong. I don't know if it is failing because of the NT authentication, or because of the named instance. Something to note, the sql server is not a part of the domain, and its hostname does not currently resolve to the IP. Any clues?

Replies are listed 'Best First'.
Re: DBI and FreeTDS Named Instances
by dreadpiratepeter (Priest) on Aug 10, 2009 at 23:59 UTC
    If you are running on windows, you don't need to pass the username and password fields, they should get picked up automatically from your login.


    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
      Yes that's true, and that works fine, but we are trying to pull from a Linux server. This makes the connection that much trickier.
        in that case the issue is going to be a configuration issue with freetds. It took me forever to get it right. remember that you have to configure the servers in freetds.conf and the dbs in the .odbc.conf file in the home directory of the user running the code.


        -pete
        "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://787424]
Approved by sweetblood
help
Chatterbox?
[ambrus]: "you are far more likely to be squished between two other dudes" => wait, really? aren't most planes, weighted by people traveling on it, so narrow that there are only two or three seats on each side of the one corridor, so only one third of the people ge
[ambrus]: t squished between two other people?
holli is about to take the first hit since a month and this weed is strong shit. Should my head explode, someone call 911.
[ambrus]: And even when I traveled on a big plane for a long flight, it had 3 seats, then corridor, then 4 seats, then corridor, then 3 seats, so less than half of the people sit between two other dudes.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-12-18 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (486 votes). Check out past polls.

    Notices?