Re: SQL Server 2005 Express - only one connection



This sounds like your application connects thorough a user instance
connection and SSMS is connecting through the main instance. Basically you
have two different copies of SQL Server trying to open the same file for
write and SQL Server doesn't allow that. You either need to change your
application to not specify user instance in the connection string or open up
the connection from SSMS through the user instance named pipe. There's a
better explanation of all this here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp


--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Dennis Ginley" <dginley AT comcast DOT net> wrote in message
news:uWVHRJoHHHA.1276@xxxxxxxxxxxxxxxxxxxxxxx
Hi, all,

I have SQL Server 2005 Express and Visual Studio 2005 installed on the
same machine. I created a database using Management Studio Express, and a
C# application to access the database. Here's the problem:

I can connect to the database via either the C# application or the
Management Studio, but not both. If I connect first via Management Studio,
when I then open Visual Studio and the the Server Explorer, the database
name has a red X next to it and I can't establish a connection.

If I connect first via my C# application, I can't even open the database
in Management Studio. There, the database does not have the plus sign to
its left, so it can't be expanded to show tables, etc. If I right click on
the db name and click Properties, I get a dialog with the following
messages:
"Cannot show requested dialog.(Microsoft.SqlServer.Express.SqlMgmt)
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
Database 'Name' cannot be opened due to inaccessible files or insufficient
memory or disk space. See the SQL Server errorlog for details. (Microsoft
SQL Server, Error: 945)"

Within Management Studio, all of the logs that I can find are empty, so
there's no help there. In the system event log I see this:
"FCB::Open: Operating system error 32(The process cannot access the file
because it is being used by another process.) occurred while creating or
opening file 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\MutualFunds.mdf'. Diagnose and correct the
operating system error, and retry the operation."

Based on that message, it looks like a file sharing problem, but I can't
see any setting to change to allow multiple connections to the database
file. The fix is probably something simple, so if someone could slap me
upside the head I'd really appreciate it.

Once I've connected with one method, the only way to connect with the
other method is to reboot the system.

The system is running XP Pro with SP2, in case that's important.

Thanks,
Dennis



.



Relevant Pages

  • Re: My Book is Incomplete Regarding SQL Commands ;-(
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... Create a Connection object and pass in a ConnectionString to ... manage the database table you reference. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: (Newbie)Application Roles
    ... level: the database itself. ... SQL Server accommodates these needs through the use of application ... the user's connection through a specific application. ... the connection permanently loses all permissions applied to ...
    (microsoft.public.sqlserver.security)
  • Re: Help! Set up Windows Group to access application
    ... The connection string for a trusted connection is: ... --add login as database user ... SQL Server MVP ... If you have troubles with finding your ways in Crystal Reports, ...
    (microsoft.public.sqlserver.security)
  • Re: My Book is Incomplete Regarding SQL Commands ;-(
    ... Visual Studio but not to VS 2003. ... Create a Connection object and pass in a ConnectionString to address ... manage the database table you reference. ... Yep, my latest book can help too, but mostly if you're targeting SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: SQL Server 2005 Express - only one connection
    ... to include "User Instance= False" and it fixed my problem. ... connection and SSMS is connecting through the main instance. ... C# application to access the database. ... Management Studio, but not both. ...
    (microsoft.public.sqlserver.connect)

Loading