Solved

Visual C#, Best way to access database over intranet with Windows Application

Posted on 2009-05-05
3
1,185 Views
Last Modified: 2013-12-17
Hi Friends,

I am developing a Windows Application in VS 2008 with C#, this application will be installed on multiple computers in same office/Network and will access same database which will be saved on one computer at a pre-defined location. Now please suggest me.

1. How I can make my application to automatically discover the database, if not possible how i can serve the same database to my application installed on other computers in same network effiently.

2. Can I make a small Server sort of application which announces its presence on server and my application listen to that and connect for database access.

3. Right now we just map a network drive to shared database location and use it in our connection string. but for this we have manually change the connection string. Is it a recommended practice.

thanks in advance.
0
Comment
Question by:ArunVashist
3 Comments
 
LVL 27

Expert Comment

by:MikeToole
Comment Utility
1) There's no built-in method in Access to announce the presence of a database - if you need that use SQL Server as your db engine (the Express edition is free!)
2) Again, this is the way that SQL Server handles it.
3) Set-up a share on your server and use UNC naming to in the connection string, e.g. \\MyServer\MyShare\MyAccessDB.mdb  - then at least you don't have to worry about drive mapping
0
 
LVL 39

Accepted Solution

by:
thenelson earned 250 total points
Comment Utility
Splitting databases is a very common practice. Using common terminology will simplify the discussion. The part of the database that contains and serves the data is called the "backend". The part of the database that does most of the work and interfaces with the user (your C# program) is called the "frontend".

>2. Can I make a small Server sort of application which announces its presence on server and my application listen to that and connect for database access.<

How would the backend announce its presence? By writing a file somewhere? By creating a message? The front end will need to know where to look for the file or message. If there is a predetermined location for the file or message, why not just have a predetermined location for the backend. For speed and reliability, the location of the backend is important so you want to decide where to place it with careful deliberation anyway. I have a utility to use in An access frontend that that will search for and link to the backend at: http://www.thenelson.name/, Link To Backend. It in written to be placed into an Access front end so You would need to comet it but it may give you some ideas.

All databases are heavy network users. To reduce the risk of corruption and speed up the database, these are things to do for any database:

1: Make sure your hardware is in top shape, all computers are routinely vacuumed to remove dust and lint and your network is set up correctly. Have all the machines on the same domain.

2: Have individual front ends on each machine. I created a database that checks the server for a newer copy of the front end, downloads it if needed, then runs it. You can get a copy of it at: http://www.thenelson.name/, Updated Front End. This utility will work for a C# frontend with some modification.

3: Create a mapped drive for the backend or place the backend folder as close to the root folder and use only UNC path to the backend (the UNC path string should be as short as possible). Some people (and Microsoft) say the mapped drive is better, some say the UNC path is better. I have found it depends on the network setup.

4: Have the name of the backend and the name of the folders in the UNC path to it as short as possible meeting dos 8.3 naming specs and with only alpha numeric characters. \\server1\C:\db\db1_be.mdb is better than \\Database Server 601\C:\My Database Folder\Database Backends\My Database Backend_be.mdb

5: Don't run a local copy of the front end on the machine that has the backend -- best to have the backend on a true server running a domain with all workstations subscribed to the domain. You might get by running home version for two computers, maybe three sharing a very small, simple Access database on the home version although you may run into sharing problems. In a work situation, running a multi user Access database, all workstations should be running the pro version. It you have less than about five workstations, you might get away with the backend being on a system running pro but more than that or with a complicated database, you need a domain and the sever running a server OS. Get up to a dozen heavy users or a couple of dozen light users and the server should be a true server, be dedicated to only serving the one database and the backend should be SQL Server (or SQL Server Express)

All of this is cutting down the number of times accesses need to be qualified, files need to be opened and closed and reduces the complexity of parsing the path all of which reduces the chance of corruption and speed up the database.
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
1. and 2.
Not easily and not recommended.

3. Recommended.
At all our clients we use mapped drives. If your environment lacks this option, just use the UNC path as already explained.

/gustav
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Usually shares are where we want them for our users and we tend to take them for granted. There are times, however, when those shares may disappear causing difficulty for your users. One of the first things to try is searching for files that shou…
Moving your enterprise fax infrastructure from in-house fax machines and servers to the cloud makes sense — from both an efficiency and productivity standpoint. But does migrating to a cloud fax solution mean you will no longer be able to send or re…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

762 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

8 Experts available now in Live!

Get 1:1 Help Now