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.

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
[mark4]: Did activestate use to inclued teh perl packager, pp.exe in the standard distribution? I can't fine "pp.exe" anywhare.
[marto]: no

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (14)
As of 2018-01-19 14:04 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (218 votes). Check out past polls.