Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Problems connecting to MS SQL 6.5 server

by Sparkie (Initiate)
on Nov 08, 2000 at 17:50 UTC ( [id://40519]=perlquestion: print w/replies, xml ) Need Help??

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

Hi there, I am trying to connect to a MS SQL 6.5 server and when ever the program is run it just hangs, I tried commenting out the SQL commands and then the program worked fine. It doesn't crash the whole system (Win NT) just hangs the program. The first few times that I tried to connect it worked fine but then all of a sudden it stopped, could it be a problem with the server? (I can't find this out because it is over a network and I don't have access to the server.) Here is the connect statement that I am using:
use DBI(); $DSN = 'driver={SQL Server};Server=pc62003302;database=TLRS;uid=sa;pwd +=;'; $dbh = DBI->connect("dbi:ODBC:$DSN",'','') or die "$DBI::errstr\n";
Thanks Sparkie

Replies are listed 'Best First'.
Re: Problems connecting to MS SQL 6.5 server
by c-era (Curate) on Nov 08, 2000 at 18:28 UTC
    When using ODBC I usually use this
    use DBI; my $dbh = DBI->connect('DBI:ODBC:NAME','user','pass') || die $!;
    Where NAME is the name of the ODBC database. Also, make sure you have an entry for the database in ODBC on each pc you use it on (Start->Settings->Control Panel->ODBC Data Sources and put your entry under the System DSN tab). If you still have problems, post more of your code so we can see what is going on. I also found this in the README.adabas that comes with DBD::ODBC
    I'd be happy to leave this away and use the dsn dbi:ODBC:servernode=192.168.1.2;serverdb=MYDB or something similar, but I didn't get this working. Perhaps someone a +t SAG can help?
RE: Problems connecting to MS SQL 6.5 server
by PsychoSpunk (Hermit) on Nov 08, 2000 at 21:13 UTC
    I've said it before, and I find myself saying it again:

    Sometimes DBD::ODBC isn't the right choice. Note that I also caused Ovid to post a bit of a rant with that one as well. I'm not advocating that you must use the "one true solution" or anything. I'm just saying that if you have the flexibility to use DBD::Sybase or DBD::FreeTDS (which I've had connection issues with), then don't get locked down in the ODBC solution. DBD::Sybase works extremely well with MS SQL Server 6.5, btw.

    ALL HAIL BRAK!!!

Re: Problems connecting to MS SQL 6.5 server
by clemburg (Curate) on Nov 08, 2000 at 20:34 UTC

    Do you explicitly close down the connection to the server when disconnecting? You should always do that to avoid resource problems at the server side.

    Christian Lemburg
    Brainbench MVP for Perl
    http://www.brainbench.com

Re: Problems connecting to MS SQL 6.5 server
by extremely (Priest) on Nov 09, 2000 at 15:45 UTC
    I gotta say I use DBD::Sybase as well. Much happier with it than ODBC. OTOH doing it the ODBC way is likely "more correct". =)

    --
    $you = new YOU;
    honk() if $you->love(perl)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-16 21:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found