Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Pulling data from an Access DB using Perl

by Apterigo (Scribe)
on Oct 30, 2000 at 20:40 UTC ( #39116=perlquestion: print w/replies, xml ) Need Help??

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

I just wanted to know if it was possible to pull information from an access database using perl? If so, could someone produce some sample code or tell me where to look to find it?

Apterigo
  • Comment on Pulling data from an Access DB using Perl

Replies are listed 'Best First'.
Re: Pulling data from an Access DB using Perl
by Trimbach (Curate) on Oct 30, 2000 at 22:32 UTC
    And, in case you're curious, here's a throwaway program I threw together once just to see if I could get it to work:
    use Win32::ODBC; $Data = new Win32::ODBC("DatbaseTest"); unless (defined($Data)) { print "Failed to connect to the DSN.\n"; exit(); } $command = qq{SELECT * FROM "Test Table" WHERE (("vacancy" = 'W9920') +AND ("FullName" CONTAINS 'ke'))}; if (! $Data->Sql($command)){ @FieldNames = $Data->FieldNames(); while($Data->FetchRow()){ undef %Data; %record = $Data->DataHash(); print "Name is $record{'FullName'}\n"; } exit(); } else { print "Error:".Win32::ODBC::Error(); }
    This assumes, of course, that you have established an ODBC data source using the ODBC Control Panel in Win98/NT.

    Gary Blackburn
    Trained Killer

Re: Pulling data from an Access DB using Perl
by KM (Priest) on Oct 30, 2000 at 20:49 UTC
    DBD::ODBC, also if you are using Win32 Perl, you can also use Win32::ODBC which should come with the standard ActiveState distro.

    Cheers,
    KM

(ar0n) Re: Pulling data from an Access DB using Perl
by ar0n (Priest) on Oct 30, 2000 at 20:46 UTC
Re: Pulling data from an Access DB using Perl
by jptxs (Curate) on Oct 30, 2000 at 20:53 UTC

    In general, if your question includes the word 'database', you should be thinking DBI. There's a great book on it called Programming the Perl DBI.

    in short the DBI is a database independant interface for Perl that allows you to interact with anything from a CSV file to DB2 on a mainframe ( if you're that wealthy ) and everything in between. It would allow to pull data, manipulate it and put it back in.

    "sometimes when you make a request for the head you don't
    want the big, fat body...don't you go snickering."
                                             -- Nathan Torkington UoP2K a.k.a gnat

Re: Pulling data from an Access DB using Perl
by FouRPlaY (Monk) on Oct 30, 2000 at 23:11 UTC
    Check out this for a nice tutorial on interacting with MS Access.



    FouRPlaY
    Learning Perl or Going To Die Trying

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-08-16 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?