Solved

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

Posted on 2009-05-05
3
1,196 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
ID: 24312608
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
ID: 24314206
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 50

Expert Comment

by:Gustav Brock
ID: 24334165
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access Database 5 40
Access Query Top 20 from subquery 11 39
Access Query: Text to Date 10 28
ASP Classic Query that needs to display more information 18 32
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

713 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