Sunday, February 12, 2012

can''t connect to local user instance

Just when I think I have this stuff figured out, it bites me back everytime.

I'm

trying to deploy an mdf out to a different machine, and attached to it with local user instance. I connect without problem from my development

machine with a local user instance, which also has Express Manager resident,

and I can connect to a server instance without problem.

What I can't do is

copy the .mdf database over to another workstation, which has Sql Native

Client installed, and connect to the database using a local user

instance! I can connect to a server instance without problem from this

other workstation. Here's my connect string for local user instance

that works fine from my dev machine:

Provider=SQLNCLI.1;Persist

Security Info=False;Integrated Security=SSPI;Data

Source=.\sqlexpress;AttachDBFileName=<full path_name and mdf

filename>;User Instance=true;

The error I get upon trying to connect with other stations is:

Error -2147467259
Database not found or cound not connect to database

I've

tried this every way I know how. I've copied the database from my dev

machine both with and without having detached the database from the

local instance. I've tried detaching from a server instance and copying

the file over. Nothing works, and I've done this before! What gives with this thing?

Rick

Hi,

is SQL Server Service allowed to access the datafiles ?

Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||Jens ... How can tell this? What service should I examine? I don't see any reference to the Sql Native client, other than I know it's installed.

I thought this process consisted of:

- install the Sql Native Client on target machine
- put a local copy of the database on target machine
- connect to the mdf with a local user instance

As I said, I can connect to remote server database from the machine. The folder names differ from my development machine to the target machine, but that shouldn't make difference, should it? I will say that in Sql Express Manager on my dev machine (which works), the full path and database name (i.e..c:\_source\project\mydata.mdf) shows in the database tree.

Rick|||

Hi Rick,

SQL Express does not allow attaching database from a UNC or mapped drive. It wasn't totally clear, but it reads like that what you're trying to do. Also, you can not connect to a User Instance on a different machine as User Instances only support local named pipes connections.

Mike

|||Nevermind. I'm apparently having a mental episode and forgot the one vital requirement of installing SqlExpress on the target instead of just the Sql Native Client. Hadn't had to do this in a while since I've been hitting a server for Sql Express databases. Sorry!

Rick

No comments:

Post a Comment