Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

linuxdata to MSSQL database

by Anonymous Monk
on Jul 24, 2002 at 10:50 UTC ( [id://184762]=perlquestion: print w/replies, xml ) Need Help??

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

I have been using a perl script to parse and filter a huge data set on a Linux machine, and was wondering if I could skip writing out in txt files and write directly into tables of a MSSQL database on a windows machine. And if possible what kind of drivers do I need

Replies are listed 'Best First'.
Re: linuxdata to MSSQL database
by hacker (Priest) on Jul 24, 2002 at 12:00 UTC
    Writing to text files is probably redundant. You should look into using the MSSQL::DBlib and MSSQL::Sqllib modules (see also pm nodes here on MSSQL), FreeTDS (see also pm nodes here on FreeTDS)and use the methods contained therein.

    You could also use raw ODBC methods through DBI with something like:

    use strict; use warnings; use DBI; my $dbuser = "foo"; my $dbpass = "bar"; my $dbname = "blort"; my $dbhost = "localhost"; my $dsn = "DBI:ODBC:database=$dbname;host=string"; my $dbh = DBI->connect($dsn, $dbuser, $dbpass, $dbhost {RaiseError => 1}); # .. Execute your query on $dbh here, SELECT/INSERT/etc. $dbh->disconnect;

    (I initially read this and thought MySQL, and had included a good example snippet of code you could use, but then re-read it as MSSQL when I previewed it. I've never used MSSQL, so I updated my reply to be more helpful in this environment.)

      I just did this at our company. I used FreeTDS, DBI, and DBD::Sybase. Went rather smoothly. Didn't have to pay for any extra ODBC bridge stuff and made my boss happy:)

      What version of MSSQL are you going to use? I'm only using 7.0 and I know the Sybase module works well up to this point. But I'm not sure about MSSQL 2000.

      Also, if you decide to try FreeTDS you'll have to go through FreeTDS.org and get on the mailing list. It is very helpful.

      peppiv

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-23 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found