I'm a newbie working with perl/cgi, and in my attempt to teach myself what's up with it, I've run into a snag that hasn't been solved by exhaustive googling. I'm attempting to get data from an Access 2003 database using a perl script (with ActivePerl 184.108.40.2067) and I keep getting the error:
DBI connect('%name%) failed: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (SQL-IM002))DBD: db_login/SQLConnect err=-1)
I don't know jack about ODBC drivers, and I'm just now learning perl, so I'm assuming that the syntax of my script is no good:
#open connection to Access database
my $DBH = DBI->connect("dbi:ODBC:%name%");
I've seen a bunch of examples of working code that allows you to open an access database, but what confuses me is exactly what's happening (makes it tough to figure out what I'm doing wrong). %name% should be the filename (without the extension?) of a .dsn file located in Program Files\Common Files\ODBC\Data Sources in XP Pro, right? I got that .dsn file set up through a wizard in the export option of Access, which gave me an error:
You cannot use ODBC to import from, export to, or link an external Microsoft Jet or ISAM database table to your database.
not quite sure what the hell that's supposed to mean, but I'm certainly not trying to do anything tricky - just create a connection to let Perl read from my access database (i.e. learn to crawl before you learn to walk). I noticed a few results on Google mentioning that there was a problem with the DBI:ODBC module in activeperl, is that the case?
I just want to be able to create a connection to the Access databse - eventually this will become a CGI script to take form input from a web page and use it to search the database for records matching the input criteria, then output some data from the matching records to the user - not rocket science but tricky enough for a novice.
Any ideas where I might be screwing up? Any common pitfalls to look out for? Any obvious mistake in something I mentioned above?