Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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.

Comment on mssql 2000
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-02-01 00:34 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (262 votes), past polls