Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2015-07-04 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls