Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: How can I import text to Access

by Broggy69 (Novice)
on May 28, 2015 at 18:03 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1128168]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (9)
As of 2024-04-23 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found