I've found the article I mentioned below... In the April 2002 issue of Linux Journal (www.linuxjournal.com), "Connect to Microsoft SQL 2000 with the Perl Sybase Module" (pg.62) by Andrew Trice.
 
provides an alternative to just ODBC connections...
 
Joe.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Joseph Youngquist
Sent: Tuesday, May 21, 2002 9:03 AM
To: [EMAIL PROTECTED]
Subject: RE: Opening MS-SQL DB with Perl

I'll shut-up, and learn to read :)
 
I vaguely recall that there are some difficulties in connecting to MSSQL 2000 but cannot remember the article...it was in one of the Linux periodicals about 2 months ago...I'll see if I can find it a bit later on...
 
 
And I apologize about my response to the question...
 
Joseph Youngquist.
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Tillman, James
Sent: Tuesday, May 21, 2002 9:39 AM
To: 'Joseph Youngquist'; 'Dovalle Yankelovich'; 'Perl32 (E-mail)'
Subject: RE: Opening MS-SQL DB with Perl

Um, guys, the question was about MSSQL, not MySQL.
 
However, as a testament to the power of DBI, the only line that has to change in your example is:
 
my $DataSource = "DBI:mysql:$DataBase";
 
becomes
 
my $DataSource = "DBI:ODBC:$DSNName"; #Where $DSNName is your DSN
 
You'll need to fix the $Username variable, of course, and the password would be the 3rd parameter in the connect() method call.
 
jpt
-----Original Message-----
From: Joseph Youngquist [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 9:29 AM
To: 'Dovalle Yankelovich'; 'Perl32 (E-mail)'
Subject: RE: Opening MS-SQL DB with Perl

You'll need the BDI module and the DBD::MySQL module.
 
To connect to a database:
my $dbh;
my $DataBase = "Online";
my $DataSource = "DBI:mysql:$DataBase";
my $UserName = "userName\@localhost";
 
$dbh = DBI->connect($DataSource, $UserName);
 
 
To insert a (new) row of data into a table: (One of a few ways to do it)
my $statement;
$statement = "INSERT INTO article VALUES ( '', '$Line_up', '$Line_up', '$Line_up', '0', '$Processed_state', '$Date', '$ModifiedTime', '$SectionType', '$SubSectionType', '$Filename', '$Story_link', '$Photo', '$Headline', '$Drophead', '$Byline', '$Story_text', '', '-1', '4')";
$sth = $dbh->prepare($statement);
$sth->execute;
 
There is just a little for an example, the DBD-MySQL documentation is a must read, the DBI is as well...they do explain very well the processes with plenty of example and snips of code to get you on your way.
 
 
 
 
 -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dovalle Yankelovich
Sent: Tuesday, May 21, 2002 10:04 AM
To: Perl32 (E-mail)
Subject: Opening MS-SQL DB with Perl

Hi,
I need some help...
I'm looking for perl script (example) which take data from MS-SQL (I need it to learn how it work, which modul is needed etc')
 
Thanks
 
Dovalle

 

Reply via email to