[EMAIL PROTECTED] wrote: > I'm trying to grab data from an MS-Access log file and put it into a > fast, read-only database. (I'm thinking SQL Lite at this point.) > Make sure that's it's only read-only after it's written to. Depending on what you're doing with the data it may be easiest and fastest to use a format that Access can work with and then dump directly to that file with something like a "SELECT...INTO..." statement and a linked table in Access. > The code below is working. Now I need to put the identical data and > structure into an SQL Lite table. Any suggestions on where to look > for examples? (or if you want to write one, that's fine too.) > > I own the book "Programming the Perl DBI", but I haven't found > anything that addresses this. > > use warnings; > use strict; > > use DBI; > use DBD::ODBC; > use DBD::SQLite; > > my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=C:\temp > \adt2_in.mdb'; > my $dbh1 = DBI->connect("dbi:ODBC:$DSN",",") or die "$DBI::errstr\n"; > > $dbh1->{LongReadLen} = 2000; > $dbh1->{LongTruncOk} = 1; > > my $sth1 = $dbh1->prepare("select message_index, message_no, > message_event, time_stamp, data from log"); > > $sth1->execute(); > > my @stash; > > while (my $hash_ref = $sth1->fetchrow_hashref()) { > push @stash, { %$hash_ref }; > } > > $dbh1->disconnect(); > > my $itemp = 1; > foreach my $hash_ref (@stash) { > print " Details of row $itemp: "; > print "\n\n"; > > foreach my $key (keys %{$hash_ref}) { > print ("$key \t $hash_ref->{$key} \n"); > } > $itemp++; > } > > Thanks. > > >
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/