473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Connect to database in non standard location

I am writing a Database application using Visual Studio 2005 and SQL
Server Express 2005. I am trying to create a back up and year end back

up plan within the program. The folder structure I want is as follows:

The main level is c:\program files\app name\database with the following

subfolders, 1) current - holds the current db (db.mdf), 2) backup -
holds the backed up databases (db1.bak) and 3) archive - holds the
year end databases (db-2005.mdf). I have two questions:

1) How do I setup the connection string to connect to a database that
is not located in the standard C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data location?
2) Is there a way to setup the security on the backup folder during
setup to allow the SQLServer2005MSSQLUser write access? I was getting
access denied running the BACKUP DATABASE db TO DISK sql statement.

Jul 8 '06 #1
2 1295
1. You need to specify the desired path when you execute the CREATE DATABASE
statement. SQL Server (Express) keeps track of where the database is so that
you DON'T need to worry about it in your connection string.

2. My advice is to steer clear of storing volatile files in the Program
Files cascade as access to this cascade is restricted.
"mr_doles" <to*******@charter.netwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
>I am writing a Database application using Visual Studio 2005 and SQL
Server Express 2005. I am trying to create a back up and year end back

up plan within the program. The folder structure I want is as follows:

The main level is c:\program files\app name\database with the following

subfolders, 1) current - holds the current db (db.mdf), 2) backup -
holds the backed up databases (db1.bak) and 3) archive - holds the
year end databases (db-2005.mdf). I have two questions:

1) How do I setup the connection string to connect to a database that
is not located in the standard C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data location?
2) Is there a way to setup the security on the backup folder during
setup to allow the SQLServer2005MSSQLUser write access? I was getting
access denied running the BACKUP DATABASE db TO DISK sql statement.

Jul 8 '06 #2
1. You need to specify the desired path when you execute the CREATE DATABASE
statement. SQL Server (Express) keeps track of where the database is so that
you DON'T need to worry about it in your connection string.
What I want to do is similar to the Quicken style backup and have the
ability to open archived databases. When I archive a database it will
make a copy of the database and append a date to it, then truncate the
original database for a fresh start. The archive databases will not be
created by the CREATE DATABASE statement. I read somewhere sometime
that you can put the path to the db in the connection string but I
can't find it now.
2. My advice is to steer clear of storing volatile files in the Program
Files cascade as access to this cascade is restricted.
Where would be a good spot to put them then? I tested with c: and got
the access denied error as well. Is there a folder that I can backup
to without worrying about security or do I need to set the security on
Setup?

Jul 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
1
by: Dave | last post by:
I am trying to learn .NET with the standard edition of VC++.NET 2003 Standard edition. When I use the wizard in the toolbox to connect to a non-microsoft ODBC data source, I get the error message...
4
by: Frank | last post by:
Hi I am a poor student studying towards my MCSD. I have managed to get a cheapish student version of vb.net. Problem is that this version does not connect to sql databases and I need it to...
0
by: Larry Rebich | last post by:
I am trying to use the sample web template that is distributed with Visual Studio 2005 called 'Personal Web Site Starter Kit'. After running for awhile it fails with the following message: ...
1
by: MSK | last post by:
Hi, I am a newbie to .NET/Networking if I develop a project in 1. VB.NET + SQL server database 2. ASP.NET + SQL server database 3. .NET ( vb or asp) + Access database
3
by: MSK | last post by:
Hi, I am a newbie to .NET/Networking if I develop a project in 1. VB.NET + SQL server database 2. ASP.NET + SQL server database 3. .NET ( vb or asp) + Access database
6
by: Al G | last post by:
Can someone tell me what I need to get connected to our AS400? I am trying to write an app in VS2005(Data source, Gridview) that requires data from files on our AS400. I've downloaded DB2, and...
0
by: moyoal | last post by:
Dear All, this is my first experience to connect forms and database using VPN / DSL from other location. we have client/server architectures, .FMX are available in 212.147.1.63 server. ...
7
by: sanjay | last post by:
Hi to all the people. please will u tell how can i Connect to the Database through C program. i have No clarity in that.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.