Groups | Blog | Home
all groups > sql server programming > february 2007 >

sql server programming : Failing To Understand Security Requirements of SQL Databases


Ken Ellis
2/4/2007 12:36:58 PM
I'm struggling to understand the security requirements when working with SQL
Databases.
I'm using Windows XP and I logon as Ken and my domain is STUDY and I have
admin rights.

I have created a database, KensDemo.mdf, using SQL Server Management Studio
Express
so, naturally, when I go into this program it shows the database in the
object explorer and I can
view it and manipulate it according to the rules of the program.

I have written a simple ADO.Net C# program using VS 2005 Professional and
the connection string

@"Data Source=(local)\SQLEXPRESS; Initial Calalog=KensDemo; Integrated
Security= True"

and the program can access the data base with no problems.

The problem arises when I want to add the data connection for the database
to Visual Studio. I get the message

Login failed. Login failed for 'STUDY\Ken'

Ken


Erland Sommarskog
2/4/2007 3:57:20 PM
Ken Ellis (main@kandmellis.plus.com) writes:
[quoted text, click to view]

And what do you specify there? It sounds as if you have selected
SQL authentication when you should have used Windows authentication.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Ken Ellis
2/6/2007 1:39:09 PM
No. I accepted the default Windows Authentication when trying to create the
connection..

I have tried different sequences using SMSE and VS and I am not getting the
login failure message now, but I still have problems. There seems to be some
incompatibility between Visual Studio 2005 and SQL Server Management Studio
Express, unless being a Newbie I am expecting too much. I assumed that I
would be able to create a database in SMSE and therafter use SMSE to control
its properties. I expected to be able to add a connection for the database
to Visual Studio and use the connection when required in any programs I
might develop.

The following experience confuses me:

I create a new database using SMSE and then close the program.
I try to add a connection for the database using VS and get the message

"Unable to open the physical file Operating System Error 32 ..... a
database with the same name exists, or a specified file cannot be opened
.....

I then close down the PC and reboot.

I open VS and I am able to add a connection to the database.

I close VS and open SMSE and access the database and display the data in the
table.

I close SMSE and open VS. The connection to the database has disappeared!.

Ken


If I create a new Database in VS, by adding a new
connection, then it does not appear in SMSE.
[quoted text, click to view]


Erland Sommarskog
2/6/2007 11:39:56 PM
Ken Ellis (main@kandmellis.plus.com) writes:
[quoted text, click to view]

Yes, Visual Studio is confusing. At least to me. I have never really
understood why I should add connections at all. Who knows which server
I will like to connect to next week?

Anyway, it sounds that your problem is more a problem with Visual
Studio, so maybe you try a forum for VS?


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
AddThis Social Bookmark Button