Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

mssql 2000

by mlhmich (Novice)
on Feb 04, 2005 at 03:31 UTC ( #427912=perlquestion: print w/replies, xml ) Need Help??
mlhmich has asked for the wisdom of the Perl Monks concerning the following question:

I know this question must get asked alot, but is there a good how to on getting DBI to work with this. (Eitther via odbc or freetds/sybase) I have done some googling with it but I can not find a complete write up.

Replies are listed 'Best First'.
Re: mssql 2000
by punkish (Priest) on Feb 04, 2005 at 04:01 UTC
    Use DBD::ODBC and perldoc DBI. It works just fine.
Re: mssql 2000
by EdwardG (Vicar) on Feb 04, 2005 at 12:36 UTC

    My module for ODBC connection to MSSQL -

    package DBC::MSSQL; use DBI; use strict; sub new { return __PACKAGE__ } # see perlmonks node_id=183417 sub connect { my ($pointless, $details) = @_; my $server = $details->{server} || '(local)'; my $database = $details->{database} || 'master'; my $uid = $details->{uid} || $ENV{OSQLUSER} || 'sa'; my $pwd = $details->{password} || $ENV{OSQLPASSWORD} || ''; my $DSN = "driver=\{SQL Server\}; Server=$server; database=$database; uid=$uid; pwd=$pwd;"; DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n"; } 1; =pod =head1 SYNOPSIS use DBC::MSSQL; my $dbh = DBC::MSSQL->connect( { server => '(local)', # optional database => 'pubs', # optional uid => 'sa', # optional pwd => '' # optional } ); $dbh->do("create table test (c char(1))"); =cut


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://427912]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2017-10-19 05:56 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (251 votes). Check out past polls.