Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
April 12, 2005, 11:58 pm
rate this thread
I'm a (or "one more") newcomer in Perl, and ask for very basic help.
Despite some time spent to read all this forum and some CPAN docs, I've
not found a simple explanation of my request however simple.
I'd like to access - read only is sufficient for the beginning - to an
MS ACCESS database from perls scripts. I'm on Win 2K.I'd like to make
simple SQL or SQL-like queries (is that a pure dream ?) :seeing my
tables, seeing the data of each table, bing able to select elementary
data in tables, and even not necessarily with joining them. ... Truly a
"basic access to ACCESS" !
.... And (to be complete) I would like to use these perl scripts from
"unix style" command lines inside a "cygnus" bash shell ... But this
detail is probably useless.
Well, I spent some time trying to configure an ODBC driver found into
the admin tools of Windows. I have "declared" a specific ".mdb" file as
ODBC souce. I have used another tool (WinBatch) which can has sample
scripts for ODBC use and which can normally detect ODBC sources.
This script correctly sees my file as ODBC proposed source. But cannot
access to it. That's why I would like to make this access from Perl scripts.
I have no "SQL server" neither "anything else server" running on my
machine. Should I ? Should I use Win32::OLE ? DBD ? DBI ? ODBC ? or
maybe SHXK::-[~#GMKX ?
What is all the stuff to install / configure / run to finally get this
simple result : simply querying a simple database ?
Re: (the simplest question of the century ?) Simple access to ... ACCESS !
Search Google Groups for "Access to MS-Access database with the Reader via
ODBC", where you'll find a thread with the same name. The link to Geoff Cox'
article has changed to http://www.micro-active.com/dbase.htm .
Search Google for "Dabbling in Live Databases Aaron Weiss" for a useful
tutorial. Another Google search for "Dabbling in Live Databases Aaron Weiss
GUFE" will show you the way to another useful tutorial.
Re: (the simplest question of the century ?) Simple access to ...ACCESS !
Thank's one thousand times : despite the fact that it necessarily had to
work (and then should never have run at all), it has perfectly run,
rapidly, in total conformance with the "Manual", I have made my first
request without any problem, and - until here - the result is exactly
what it has to be ...!!! I've been very close to this result with the
tests I had made before (ODBC parameters good), but the result has
"exploded" only now !
Thank's again ! The face of the planet should change fast and soon, from
now ...! :-)))
Bill Segraves wrote:
## $db = new Win32::ODBC ( "DRIVER=Microsoft Access Driver
) or die ( $! ); // all arguments
$db = new Win32::ODBC ( "DRIVER=Microsoft Access Driver
Office\Office\Samples\Northwind.mdb" ) or die ( $! );
$sql = 'SELECT DISTINCTROW TOP 10 Products.ProductName AS
TenMostExpensiveProducts, Products.UnitPrice FROM Products ORDER BY
die $db->Error ( ) if $db->Sql ( $sql );
while ( $db->FetchRow ( ) )
print ( join ( "\t", $db->Data ( ) ), "\n" );
$db->Close ( );