Solved

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

Posted on 2009-05-05
3
1,202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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