Solved

creating *.mdb on the 'fly' using Perl

Posted on 2002-07-25
4
683 Views
Last Modified: 2012-05-04
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!
0
Comment
Question by:GorGor1
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:sstouk
ID: 7181001
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.
0
 
LVL 1

Author Comment

by:GorGor1
ID: 7181457
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!
0
 
LVL 6

Accepted Solution

by:
sstouk earned 200 total points
ID: 7181661
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...
0
 
LVL 1

Author Comment

by:GorGor1
ID: 7183073
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!)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now