where should I save my database when I deploy my project

Posted on 2009-12-17
Last Modified: 2012-05-08

I have a C# project which has an Access db. Now for testing I have stored it in my C:\temp folder.
But what is the best place to place the db when I deploy my project? My Documents folder? Or Program Files folder?

Question by:Pit76
    LVL 1

    Expert Comment

    if you only expect one user to use the program than put it in the users folder

    otherwise i guess you could put it in program files... this all depends on security.. if you have active directory users may not be able to save to the c:
    LVL 3

    Accepted Solution

    I don't believe there are any hard and fast rules for the location of an Access database.

    However, I'm sure this will be debated...

    In general:-

    Small, Single user, stand alone application.
    Put the database in a Sub-folder below the folder where the .exe resides

    MultiUser Application on a single network domain.
    A network shared folder created specifically for this application.

    Web application.
    Sub folder below the web root.

    Don't put it in "My Documents" or "Documents". Users will almost certainly re-arrange folders and tidy things up as required. This will break your application. If your database is in "My Documents", users will treat it as one of their own documents they can open and play with. Again, this will break your application. If you don't want users to break your database, its best to hide it away in a folder below the .exe.

    If you keep the database with the .exe or in a folder below the .exe, ther will be no confusion that this database belongs to this application.

    In larger applications and more formal deployments you would keep the database in:


    %AppData% is an environment variable that resolves to:-

    In XP and 2000...
    C:\Documents and Settings\<username>\Application Data\

    In Vista and Windows 7...

    Just type %appdata% in your windows explorer to go there and see how other applications have stored data.

    Don't hard code the path, you dont know if it's being deployed to XP, Vista or whatever. Always deploy using the %AppData% environment variable in the deployment path.

    Hope this helps



    Author Closing Comment

    Thx, great and clear explaination!
    I can understand and agree with these recommendations.

    LVL 3

    Expert Comment

    by:Paul Thompson
    You may want to take a look at %ProgramData% too.
    All users on that machine can access this folder.

    %AppData% tends to be user specific.


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now