Database Location in a Multitier Soulution

M

Martyn Fewtrell

Hi there

I am just canvassing some opinions so feel free to add yours.

I mainly work with VB.Net on dynamic websites driven by Access and have more
recently been trying to introduce Business and Data layers. Most of my
projects are fairly small so the justification for the extra work is
marginal but it helps to clean up the projects and I can see the value.
However this is my issue.

By default if you add an Access database to a web project VS2005 likes to
place it within the App_Data folder which is fine if you want to use it from
within the same project. If you introduce the concept of a DataAccess layer
then how does the DataAccess layer connect to the database during
development (VS2005 needs to se the database). I assume that once the
DataAccess layer is compiled the DLL gets added to the Bin folder of the web
project so accessing the App_Data folder isn't a problem at that stage. To
make things worse during development I work against an IIS development
server running on Win2003 (set up to mirror my live hosting environment) but
my Visual Studio Projects are stored in the MyDocuments folder of my
workstation which happen to be redirected onto a different server (which is
backed up each night). If I create a solution in VS2005 the website is on
one server, any other VB projects end up on the other server and VS2005 is
on my workstation.

Obviously with an SQL project this isn't an issue as I can hit the database
from anywhere in the network.

I'm just curious as to how other web developers set up their working
environments and/or get around this problem.

Your views please.

Martyn Fewtrell
(e-mail address removed)
 
K

Kevin Spencer

With Access, the Connection String determines the location of the database
file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 
W

William Buchanan

Really, it doesn't matter where the DB file is. What matters is the
connection string (as Kevin has pointed out). When you deploy your site, the
DB might end up somewhere completely different, so you can't rely on it
being in the App_Data folder anyway.

What you will have to do though....
When you create your data layer (I guess this will be in a separate class
library dll), you will notice that it gets its own app.config file which
also has a connection string in it. When you deploy your site, you will have
to move this connection string from the app.config into the
<connectionstrings> section in the web applications web.config file.


Will
 
M

Martyn Fewtrell

Thanks for both replies.

I am aware that the connection string defines (or at least points to) the
location of the database. Currently I have the live database located on a
folder on the web server, with a duplicate database on the same relative
path on the workstation. i.e. two copies of the database . When working
within VS2005 all the design time functions work as it hits the database on
the workstation and when I test the project it still works as the project on
the web server hits the real database at the same relative path on the web
server and I don't need to rewrite the connection string. Its just all a bit
messy having two copies of the database and thought there might be a better
option.

Martyn Fewtrell
(e-mail address removed)
 
K

Kevin Spencer

Perhaps using an absolute path would be better?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top