in reply to Re: Reading from a file and writing the content into a database
in thread Reading from a file and writing the content into a database
I don't have the DBI module i get this error: Can't locate DBI.pm in @INC (@INC contains:#!perl/bin/perl use win32; use Win32::ODBC; use CGI qw(:standard); $data="ibd_lib.txt"; $test="test.txt"; my (@statement); # array of sql statements my $db=new Win32::ODBC("DSN=bisx;UID=;PWD="); ### report connection status if (!$db) { print "\nunable to connect to database!\n"; die(); } ### Open File for Reading open(FR, "< $data") || die "cannot open $data for reading: $!"; ###open(FW, "> $test") || die "cannot create $test: $!"; while(<FR>) { ### Write to Database push @statement, "INSERT INTO UserTestingE (ID) VALUES (\t$_\n)"; ### print FW $_; } ### Close the file close(FR) || die "cant close $ibd_lib: $!"; ###close(FW) || die "cant close $test: $!" ### Close the database $db->Close();
The only way that i know how to write to an access databse is using the Win32::ODBC module just like above. I just don't know if i'm doing it right or what is going on. Please take a look at it and tell me what you think. the file is a comma delimited file that has about 10,000 lines and i need to take each line and insert it one after another in an access database. Thanks, Elvin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Reading from a file and writing the content into a database
by btrott (Parson) on Apr 01, 2000 at 02:19 UTC |