Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

MS ACCESS/ODBC Not allowed

by Angel (Friar)
on Nov 13, 2002 at 01:31 UTC ( [id://212469]=perlquestion: print w/replies, xml ) Need Help??

Angel has asked for the wisdom of the Perl Monks concerning the following question:

I am currently using a hosting company that while having MySQL does not allow ODBC access to the database. ( They cite security concerns ). We run a large camping event and right before dump all of our registration data into MS Access. ( My boss knows how to use it and we do not have a connection at the site to talk to the server back home ). I have seen modules to write to MS Excel files but none to write to Access files? Does that exists and I can't find it?

Is there a way to get around the fact that they won't let me have odbc access short of writing an adminstration script ( which we are doing ) so I can just grab the data?

Replies are listed 'Best First'.
Re: MS ACCESS/ODBC Not allowed
by DamnDirtyApe (Curate) on Nov 13, 2002 at 01:37 UTC

    I don't know much about MS Access, but I assume it can import CSV files. If this "dumping" is a one-shot deal for the event, could you export the data from MySQL as a CSV file (possibly using Perl), then import that into Access?

    FYI, Perl can talk to Access, but I believe it needs the DBD::ODBC module to do so.

    Update: Here's a little script that exports a PostgreSQL table of mine to a CSV file. You can adapt this to your MySQL table with only a couple of changes (connection string, user/pass, table name.)

    #! /usr/bin/perl use strict ; use warnings ; use DBI ; use Text::CSV_XS ; my $dbh = DBI->connect( 'DBI:Pg:dbname=odms', 'doug', '' ) or die "Couldn't connect: $!" ; my $csv = new Text::CSV_XS ; my $sth = $dbh->prepare( 'select * from v_doc_list' ) ; $sth->execute ; while ( my $ary_ref = $sth->fetchrow_arrayref ) { $csv->combine( @$ary_ref ) or warn "Error: could not construct CSV string from [@$ary_ref]" + ; print $csv->string, "\n" ; } $dbh->disconnect ; exit ;

    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
Re: MS ACCESS/ODBC Not allowed
by dws (Chancellor) on Nov 13, 2002 at 01:43 UTC
    Is there a way to get around the fact that they won't let me have odbc access short of writing an adminstration script ( which we are doing ) so I can just grab the data?

    Is the registration data you're trying to dump in MySQL? If so, there are a couple of ways of getting into MS Access.

    One fairly easy way is to write a script to pull the data out into tab- or comma-delimited files, then download the data (as a text file through your browser) an import into Access. Text::CSV might be of help.

    A more complicated approach is to pull data out of MySQL and create an Excel spreadsheet using Spreadsheet::WriteExcel. This is probably overkill.

Re: MS ACCESS/ODBC Not allowed
by AcidHawk (Vicar) on Nov 13, 2002 at 13:46 UTC

    I have searched for a way of connecting to a MSAccess database from *nix and have never found any way other than ODBC.

    The problem I think is in the dlls that are required for queries to the database. In terms of writing data to MSExcel files typically people use the Win32::OLE, a host of Spreadsheet modules or the DBD-Excel method.. but I haven't tried this on anything that is not a MS platform though.

    Can you not dunp the data to a MySQL db and just create a web front end for you boss to use..? although you did mention not really wanting to have to write another admin script.

    Update: Have you thought about dumping the data to XML at all..?

    -----
    Of all the things I've lost in my life, its my mind I miss the most.
Re: MS ACCESS/ODBC Not allowed
by Angel (Friar) on Nov 13, 2002 at 02:49 UTC
    What I really need to do is be able to write and read ms access databases on the UNIX box not from a WIN 32 box elsewhere. I read like eight million pages on how to do that but not access the database locally.

    If anyone has a module and a tutorial on this I would be deeply greatful.
      Run Access on a Unix box? Now that's something I'd like to see :) Have you tried WINE? I haven't heard of anything that can access Access files except Access - specifically msjet*.dll.

      rdfield

Re: MS ACCESS/ODBC Not allowed
by Anonymous Monk on Nov 14, 2002 at 04:51 UTC
    Someone touched on it but did not go too far.

    What about using WIn::OLE to connect to the ACCESS database.

    Now if you are running the Unix box and your boss has the Win then one option would be to compile the perl script into a standalone script and drop it on your bosses system. Then when he wants to update the database, or you what to do it just log on and run the script.

    MySQL <-> Perl <-> Win::OLE <-> ACCESS

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://212469]
Approved by grep
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found