I have a serious SQL Express connection problem on one of our customers
machine. The errormessage reads: "User does not have permission to perform
this action".
Our application is a .Net 2.0 Windows Application. Using the
System.Data.SQLClient.SQLConnection class to connect. The user is logged on
with an account that grants Administrator priviledges on the machine.
The connectionstring looks like this:
Data Source=. \SQLExpress;AttachDbFilename=C:\Temp\Tes
t.mdf;Integrated
Security=True;User Instance=True
Our company have distributed lots of applications where this works
perfectly, but suddenly we get this error on one machine.
When I use SQLCMD I can connect to the .\SQLExpress instance and attach the
file C:\Temp\Test.mdf and query the tables. When the database is attached as
"Test", I can even connect from a .Net Windows application to the database
using the following connectionstring:
Data Source=.\SQLExpress;Initial Catalog=Test;Integrated Security=True
So it seems like there is a problem with connecting using
"AttachDbFilename=C:\Temp\Test.mdf" or "User Instance=True"
Can anyone help me on this?I would go with the obvious and assume the user running your application
doesn't have write permissions on the C:\Temp\Test.mdf or C:\Temp\Test.ldf
file. This would explain all of the symptoms you have described.
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
"Allan G. P." <Allan G. P.@.discussions.microsoft.com> wrote in message
news:076BB143-01B4-4F42-853C-3C864D51DFC0@.microsoft.com...
>I have a serious SQL Express connection problem on one of our customers
> machine. The errormessage reads: "User does not have permission to perform
> this action".
> Our application is a .Net 2.0 Windows Application. Using the
> System.Data.SQLClient.SQLConnection class to connect. The user is logged
> on
> with an account that grants Administrator priviledges on the machine.
> The connectionstring looks like this:
> Data Source=. \SQLExpress;AttachDbFilename=C:\Temp\Tes
t.mdf;Integrated
> Security=True;User Instance=True
> Our company have distributed lots of applications where this works
> perfectly, but suddenly we get this error on one machine.
> When I use SQLCMD I can connect to the .\SQLExpress instance and attach
> the
> file C:\Temp\Test.mdf and query the tables. When the database is attached
> as
> "Test", I can even connect from a .Net Windows application to the database
> using the following connectionstring:
> Data Source=.\SQLExpress;Initial Catalog=Test;Integrated Security=True
> So it seems like there is a problem with connecting using
> "AttachDbFilename=C:\Temp\Test.mdf" or "User Instance=True"
> Can anyone help me on this?|||I'm not sure it would. The .ldf-file IS created when I use SQLCMD to attach
the mdf-file (still logged on as the same user). I don't believe that this
would be possible if the user didn't have write permission to the directory.
And as I described below - the user has local admin rights.
"Roger Wolter[MSFT]" wrote:
> I would go with the obvious and assume the user running your application
> doesn't have write permissions on the C:\Temp\Test.mdf or C:\Temp\Test.ldf
> file. This would explain all of the symptoms you have described.
> --
> 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
> "Allan G. P." <Allan G. P.@.discussions.microsoft.com> wrote in message
> news:076BB143-01B4-4F42-853C-3C864D51DFC0@.microsoft.com...
>|||When you connect with SQLCMD, sql is running as NetworkService or whatever
user you specified for the service to run as when you installed sql. When
you connect with the userinstance option set, sql is running as the user
running your program. If you already know what the problem is and isn't,
I'll stop wasting your time.
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
"Allan G. P." <AllanGP@.discussions.microsoft.com> wrote in message
news:8AB9575C-3961-4EB7-B3E1-64FCEA7EEE52@.microsoft.com...[vbcol=seagreen]
> I'm not sure it would. The .ldf-file IS created when I use SQLCMD to
> attach
> the mdf-file (still logged on as the same user). I don't believe that this
> would be possible if the user didn't have write permission to the
> directory.
> And as I described below - the user has local admin rights.
> "Roger Wolter[MSFT]" wrote:
>
Sunday, February 12, 2012
Connection problems SQL Express
Labels:
connection,
customersmachine,
database,
errormessage,
express,
microsoft,
mysql,
oracle,
performthis,
permission,
reads,
serious,
server,
sql,
user
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment