Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

Replies are listed 'Best First'.
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.


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);


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://117451]
Approved by root
[1nickt]: I have been an apostate in the Apple orchard for almost 15 years. But Dells are still high quality it seems, unlike Macs these days.
[1nickt]: And you can still configure the system at will, on the "Small Business" site.
[Corion]: 1nickt: I bought a 2015 XPS 13, which is a very nice and shiney (and somewhat overpriced) machine, but I think it's still better priced than an Apple machine. Now it just has to hold up 10 years like the old one did ;)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-03-27 13:01 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.