Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: How can I import text to Access

by Broggy69 (Novice)
on May 28, 2015 at 18:03 UTC ( #1128168=note: print w/replies, xml ) Need Help??


in reply to Re: How can I import text to Access
in thread How can I import text to Access

I also tried this one just now, and I get an error saying my DevComm1. +mdb file is not found. It does exist in the folder location I specifi +ed. #!perl use strict; use warnings; use DBI; print 'bits: ' . (8 * (length pack 'P', -1)) . "\n\n"; my $DBFile = q(W:\Glenn-123456\Test\DevComm1.mdb); my $dbh = DBI->connect("dbi:ODBC:Driver={Microsoft Access Driver (*.md +b)};DBQ=$DBFile",'','') or die("cannot connect to DB"); my $SQLquery = "SELECT * INTO [Input] FROM [Text;DATABASE=W:\Glenn-123 +456\Test\\VDD\Data\;HDR=No].[DevComm1.txt]"; my $sth = $dbh->prepare($SQLquery); my $rc = $sth->execute; #Trying again

Replies are listed 'Best First'.
Re^3: How can I import text to Access
by Not_a_Number (Prior) on May 28, 2015 at 18:41 UTC

    Hi, Broggy69. Did you miss or simply decide to ignore the advice given to you by stevieb?

    Looking at your nodes on screen, don't you realise that they are an unreadable mess?

    Please read How do I post a question effectively?, and then go back and edit all your posts.

    Update: The OP seems to have taken our advice and formatted their posts, albeit not very well... but at least they're readable now!

Re^3: How can I import text to Access
by GotToBTru (Prior) on May 28, 2015 at 19:26 UTC

    It may be Perl is having trouble with your Windows-style path. Try:

    my $DBFile = 'W:/Glenn-123456/Test/DevComm1.mdb';
    Dum Spiro Spero
      #!/usr/bin/perl use strict;use warnings; use Win32::OLE; my $DBFile = 'W:/Glenn-123456/Test/DevComm1.mdb' #my $DBFile = qw( W:\\Glenn-123456\\Test\\DevComm1.mdb ); #my $MSACCESS_DSN ='Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$DBF +ile ;Persist Security Info=False;'; #my $msaccess_dbh = DBI->connect("dbi:ODBC:$MSACCESS_DSN"); #Choose appropriate version of Jet for your system my $Jet = Win32::OLE->CreateObject('DAO.DBEngine.36') or die "Can't +create Jet database engine."; my $DB = $Jet->OpenDatabase( $DBFile ); my $SQLquery = "SELECT * INTO [Input] FROM [Text;DATABASE=W:\Glenn-123 +456\Test\;HDR=No].[DevComm1.txt]"; $DB->Execute($SQLquery, 128); #128=DBFailOnError #Still no look. tried a few things that are commented out. #But I have + new errors. #Unrecognized esape \G & \T line 14 #Syntax error line 12 near "my " #Global symbol "$Jet" requires explicit package name line 12 #Global symbol "$Jet" requires explicit package name line 13 #Global symbol "$DBFFile" requires explicit package name #line 13

        Missing ; at the end of the my $DBFile line.

        Dum Spiro Spero

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1128168]
help
Chatterbox?
[Corion]: Heh - vroom came with interesting news - the site will likely be migrated away from *BSD to Ubuntu soonish... Hopefully I can give the new environment a test drive before it spins up :)
[Corion]: Also, that likely means we'll get a newer Perl, so we could then move the codebase to newer features ;)
[Discipulus]: urrah!
[marto]: Hmm, I sometimes wonder if moving to a new framework (such as mojo) would encourage more developers

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2018-07-19 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (404 votes). Check out past polls.

    Notices?