Here's a cheat. 1) create, using MS Access, and EMPTY MDB file, no tables, nothing. 2) to create the db on the fly, then copy that file to your file when you need to... 3) don't use a pre-configured DSN, just use the dsn-less approach.
Example (using MS Access): my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=\\\\cheese\\g$\\perltest.mdb'; my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') or die "$DBI::errstr\n"; 4) call create table in the perl script as necessary. Note use of UNC path (with \\\\server\\share\\dir\\path.mdb). It's important to use the UNC if it's a Web service or NT service, as drive letters are not useful when running as a service. Jeff > > Alright, stupid newbie question - how do I (or can I) create a > Microsoft Access database anew with perl and the DBI? > > Situation: I have a number of working perl apps that are all > built with flat file tables (for ease of use, since the > converted-from-COBOL !!! source data was very poor and I had to > do a lot of hand-editing of the data to clean it up). The > mostly-absentee pointy-haired boss comes along and says the apps > are no good because they're not built with "real" databases. > Tried explaining the concept of relating tables by keys, he > didn't get it, so Access is his poison of choice. > > Being intrinisically lazy, I wanna use perl to create all the > .MDBs and their tables, including the metadata, in one fell > swoop. I see all kinds of information in Programming the Perl > DBI and in Win32 Perl Programming, in the docs and on the web > about connecting to a DSN or even creating a new DSN fresh with > Win32::ODBC, but I don't see how to create the database itself. > Is it possible without using the ODBC administrator? > > Please hold the rocks and bottles, > Glen >