Wednesday, March 28, 2012

restriced access

HI,

how can i restrict the access for my sqlserver DB.
I can connect with any Connection STring.
What do i have to change so that u can only access the db with the correct username and password from an app?

thats my connString.
"Data Source=TURM21;Database=Db1;User id= kr; password=hahn; Trusted_connection= true;pooling=false;"

Is it a Property Setting in Sql Server? Where is this Setting?

GreetzHi

You have two security settings in SQL Server:
Windows Authenication Only and mixed (Windows and SQL Server). Make sure you are set to use both.

Your connection string includes:
Trusted_connection= true
This means that your NT log is used to access SQL Server. The username and password you supply are ignored. It is your NT account that is giving you access to the server. Remove this from your connection string and the SQL Server username and password you supply will be used to authenticate you.

BTW - MS recommend you access SQL Server using your NT credentials.

HTH|||ok i switched to mixed authentification.

my connection string is:

Data Source=TURM21;Database=Db1;User Id=kroete;password=hahn;pooling=false;

the user was createdlike this:

CREATE LOGIN kroete
WITH PASSWORD = 'hahn';
use Db1;
create User kroete;
GO

But now i get an SQLException: error during login;

I don't know what the problem is?

Cheers|||Apart from your userID changing from the first post? ;)

Double check your password (not what I'd describe as strong BTW). Try logging via QA with those credentials. If you succeed then it is probably the client code. If you fail then your username\ password are wong.

HTH|||no the user id is correct:)

Ok i tried to connect directly (Sql Server Management Stduio) wit Sql Server Authentification and i can not connect.

Is the way, I created the user correct?

CREATE LOGIN kroete
WITH PASSWORD = 'hahn';
use Db1;
create User kroete;
GO|||ok - what's the exception description then? :)|||You forgot FROM clause in your CREATE USER statement.|||From clause? Why? And how?
Will post the exception later. Don#T have it here.

No comments:

Post a Comment