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

Perl and MS Access

by Anonymous Monk
on Oct 08, 2001 at 18:00 UTC ( #117451=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Could anybody help me connect to an MS Access database. I am new at perl and have some difficulties getting started. I understand the sql commands, but is mostly confused about the connect() I would appriciate some code :o) Badleif

Comment on Perl and MS Access
Re: Perl and MS Access
by scain (Curate) on Oct 08, 2001 at 18:08 UTC
    Try typing "MS Access" in the search box at the top of this page, after reading much of what you find there, come back and ask again.

    Scott

Re: Perl and MS Access
by mr_dont (Beadle) on Oct 08, 2001 at 21:17 UTC

    I once wrote a perl script that connected to an Access Database using the Win32::ODBC module...

    Here is a bit of code to get you started:

    # Load the module use Win32::ODBC; # Make a new database object, the dsn, # userid, and password are things you need # to fill in my($db) = new Win32::ODBC("dsn=yourdsn; uid=foo; pwd=bar"); # Send the database some SQL $db->Sql("SELECT * FROM your_table"); #print out some stuff while ($db->FetchRow()) { my(%data) = $db->DataHash(); print "Your data is: $data{'some_value'}"; } # Close the database $db->Close();

    It is a good idea to include statements that check for errors... maybe you should read this tutorial.

Re: Perl and MS Access
by jehuni (Pilgrim) on Oct 09, 2001 at 16:55 UTC

    I just posted this node in reply to a similar question. Here's the sample code included in that node:

    use strict; use Win32::OLE; my $provider = 'Microsoft.Jet.OLEDB.4.0'; my $dir = 'c:\perl\cgi-bin'; my $dbase = 'mydb.mdb'; my $user = ''; #use if needed my $password = ''; #use if needed my $connStr = "Provider=$provider;Data Source=$dir\\$dbase;User ID=$us +er;Password=$password;"; my $conn = Win32::OLE->new('ADODB.Connection') or die("Could not creat +e Connection: $!"); $conn->Open($connStr);

    -jehuni

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-10-25 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls