Thursday, February 16, 2012

Attaching MDF with AttachDBFilename?

I am attempting to attach an .mdf to SQL Express using "AttachDBFilename" in
the connection string, and I have a few questions on the issue.
I am planning on setting this up on a network with both the .mdf and the
instance of SQL Server residing on a server. All the clients will be runnin
g
an app that will have access to the SQL Server instance and the fileshare,
and they will attempt to use a connection string with the "AttachDBFilename"
.
I have successfully connected to the instance of SQL Server and have access
to the .mdf from a client, but I have not been able to get the connection to
attach the .mdf file. If I run the app on the server it works, but on a
client I get an error saying something like "The file '..' is on a network
path that is not supported for database files."
My questions are:
Can this be done using "AttachDBFilename"?
If yes, any suggestion on what I may be missing?
Even if I do get this method to work will it support multiple users?
Thanks,
JimThe database file (mdf) only needs to be attached one time -at the server.
Clients only need to connect to the server and have access to the database.
If SQL Express was installed on each client, and those clients used the
'AttachDBFilename', they would be attempting to attach a database file to
their local copy of SQL Express. Database files cannot be attached from a
unc network path. They would each need a local copy of the database for that
to work. However, it sounds like you want a centrally located database, not
individual copies.
Arnie Rowland
"To be successful, your heart must accompany your knowledge."
"Jim" <Jim@.discussions.microsoft.com> wrote in message
news:5732D62A-EE09-4ED6-8548-FFB7AC58EC2E@.microsoft.com...
>I am attempting to attach an .mdf to SQL Express using "AttachDBFilename"
>in
> the connection string, and I have a few questions on the issue.
> I am planning on setting this up on a network with both the .mdf and the
> instance of SQL Server residing on a server. All the clients will be
> running
> an app that will have access to the SQL Server instance and the fileshare,
> and they will attempt to use a connection string with the
> "AttachDBFilename".
> I have successfully connected to the instance of SQL Server and have
> access
> to the .mdf from a client, but I have not been able to get the connection
> to
> attach the .mdf file. If I run the app on the server it works, but on a
> client I get an error saying something like "The file '..' is on a network
> path that is not supported for database files."
> My questions are:
> Can this be done using "AttachDBFilename"?
> If yes, any suggestion on what I may be missing?
> Even if I do get this method to work will it support multiple users?
> --
> Thanks,
> Jim

No comments:

Post a Comment