Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and Access 1

Status
Not open for further replies.

skosterow

Technical User
Feb 23, 2002
135
0
0
US
Hey all!

Any one know of a good Perl accessing an MS Access Data base tutorial?

thanks!

-scott
 
Mike Lacey created a good FAQ in this forum to address updating an Access Database using the DBI. Take a look and see if that helps you. (It might be a good idea to take a look at the other Database FAQs in this forum as well.)

faq219-1467

- Rieekan
 
Mike Lacey's FAQ is well done. Thanks for the reference. Do you know of anything similar showing how to use ADO and a dns-less connection?

Thanks,

Parke
 
Just interested -- but why do you need to use a DSN-less connection? (didn't know you could do that) Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
I use ADO a fair bit in vbscript and vb programs. It is very convenient to write a program and be able to run it on any windows machine and not worry about having to first set up the ODBC connection. The best URL I've found for ADO connection strings is

I am assuming that since Perl can use ADO, then this aspect may also be implemented. This may be a big assumption on my part. As you may guess, I am a beginner with Perl but it looks like a neat language to get results and I may have to interact more with Unix systems.

Parke
 
Yes - just looked at the documentation on CPAN and DBI::DBD::ADO does what you want.

Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Mike:

Thank you very much. Now I can play with it to see how it works.

Parke
 
In case anyone is interested:

#! /d/program files/perl/bin/perl

use OLE;
use warnings;

print ("\tADO DSN-Less to pubs database on local MS Access database. \n");

print "\n";
# Create ADO auto object
$conn = CreateObject OLE "ADODB.Connection" ||
die "Error on ADO CreateObject: $!" ;

$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/projects.mdb;");

if ( $conn->{State} != 1 ) { # 1 is adStateOpen, 0 is asStateClosed
die ("\t Connection Not Open. Make sure the server is started.\n\n");
}

$sql = "select project_name from projectInfo";
$rs = $conn->Execute($sql) || warn "*** SELECT ERROR *** $!";

while ( ! $rs->EOF() ) # Fetch each row
{ # Print each column value
print ("\t", $rs->Fields(project_name)->Value , "\n ");

$rs->MoveNext;
}
$rs->Close;
print "finished \n";
print ("\n");

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top