Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!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();
I don't have the DBI module i get this error: Can't locate DBI.pm in @INC (@INC contains:

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


In reply to RE: Re: Reading from a file and writing the content into a database by Anonymous Monk
in thread Reading from a file and writing the content into a database by Kiko

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found