creating *.mdb on the 'fly' using Perl

I'm using Win32::ODBC to do a bunch of stuff with my Access databases in Win2k Server.  However, I'm trying to create a Database (*.mdb) file and SYSTEM Data Source Name (DSN) on the fly from the web using Perl and I've come across some serious problems that have completely stopped me in my tracks.  2 problems I need help with:

1) I have to create a SYSTEM dsn (not a USER dsn) on the 'fly' from the web.  Problem is that the web server's account doesn't have administrator priveleges so I can't create ANY dsn.  I have to create a SYSTEM dsn so that the database can be modified from the web and the only thing that Win32::ODBC seems to be capable of is creating a USER dsn.  And even THAT only works when running the perl script from a command prompt on the server.  Anyone know of any way around this??  Any way at all??

2) I can't create a valid dsn (neither USER nor SYSTEM) unless I create a blank database to point the dsn to first.  Since I want to create the system database on the 'fly' and the name of the database will come from a web form (the name is unknown ahead of time), I can't create the blank database by hand.  Is there a way to create a blank database (*.mdb) file straight from Perl?  I tried the open(FILE,$file);close(FILE); approach but it obviously didn't work.

I'm in a world of trouble here!  Is there any way to do what I'm trying to do?  I don't necessarily have to use Win32::ODBC module to create the dsn and the mdb file.  I don't care how I get it done, but I have to have it all done through Perl.  I can't do any of this by hand.  Any help will be greatly appreciated!
Who is Participating?
sstoukConnect With a Mentor Commented:
Well, you can always give specific permissions for the web account within the registry on any tree.

Just use regedt32 for setting permissions.
the problem is will it work at all even if the account can change registry...
I can't yet tell you the answer for the first question, because it needs testing, the second problem I had before and what I did was to create an empty template .mdb file and right before binding it to a DSN name I copied the file with whatever name I needed to and then created a DSN with this new file name. Don't think it is a complicated thing, just a one line of code and it will work 100%.

The first problem ... hm ... never had such requirement before. Will check this one if anyone could gine an answer to that.
GorGor1Author Commented:
that's actually the exact solution i came up with.  save a blank table as a template and then copy it on the 'fly' when required.  for the first problem, I'm going to try doing it through the registry with perl on the fly.  just haven't had a chance to check it out yet.  not sure what will happen because i don't know if the web account will have the ability to modify the registry.  only one way to find out.  do you think it'll work?  if you come up with something else, let me know.  thanks for the help!
GorGor1Author Commented:
is it safe to give full control of the ODBC.INI registry key to the web account?  will the savvy be able to hack in and get control of my access databases?  I don't know enough about the windows registry and hacker attacks to know whether or not it's a good idea.

(I gave the web account permission to the odbc.ini registry key and I am now able to create system DSN's from the web by adding keys and values.  It's pretty cool if it's safe!)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.