Creating a DSN to Access MDB under AppDataFolder

D

Dobedani

Hi there,

I am running Windows XP Professional wiith SP2. I have developed an
application with Delphi 7 which is interacting with an Access database
via a System DSN. I'm trying to make the app suitable for Windows
Vista also. In a previous release, I placed the database under C:
\Program Files\ but that is - of course - no longer done. At least, as
far as I understand: "what is necessary for Windows Vista" is already
good configuration practice for Windows XP - is that right?

If my application is used by more than one user on the same machine,
then the users should be looking at the same Access database. I
therefore felt that placing the MDB-file here would be a good idea: C:
\Documents and Settings\All Users\Application Data\MyCompany\MyAppName
\

Unfortunately, the ODBC Data Source Administrator of my Windows XP
installation does not allow me to browse to that directory! Try it, if
you don't believe me! It is most likely because "Application Data" is
a hidden folder by default. Undoing the hidden property does however
not help. Silly! Is there another way to create a System DSN? Then
where am I supposed to host my MDB files? Any help will be
appreciated ...

Kind regards,
Dobedani

Wageningen
The Netherlands
 
D

Douglas J. Steele

Have you tried a DSN-less connection? Far simpler...

I show how to do it for linked SQL Server tables at
http://www.accessmvp.com/DJSteele/DSNLessLinks.html (there's also a link
there for how to create a DSN, although again it's for SQL Server).

On the other hand, DSNs are simply registry entries. You can create the
appropriate .reg file, or use API calls to write to the registry. System
DSNs should be in HKLM\Software\ODBC
 
D

Dobedani

Hi Douglas!

Thanks for your answer. A colleague made the app with a DSN and
changing it will take too much time. It would be possible though to
make it with a DSN-less connection - in Delphi too, yes.
Another colleague pointed out that in the ODBC Data Source
Adnministrator there's no need to use the "directory browser" (the
window with title 'Select database'): it is possible to just type the
full path to the MDB-file into the box with label 'Database Name'! You
may think that the box is reserved for the file name only, but it
isn't!

Anyway, I'm happy because I can host my MDB file where I wanted :) :
C:\Documents and Settings\All Users\Application Data\MyCompany
\MyAppName\

Kind regards,
Dobedani
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top