Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Setting user-pass in a database

Author  Topic 

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2009-09-16 : 21:42:04
Hello.
I have the SQL server with windows authentication.
What i want to do is to set a database so that it can be accessed with username and password, even thought i have windows authentication enabled so i can access it with Visual studio .net.
So i went to the general database security and created a new login with server roles "public,securadmin,sysadmin".
Then i went to the database in question and created a new user.I gave him the login name of my newly created login roles member i checked accessadmin and security admin.
No when i try to connect withing visual studio with the credential schema:
Data Source=Myserver;Initial Catalog=Mytestdatabase;User Id=commando;Password=apassword;Integrated Security=False

It give me the error:
Login failed for user 'commando'. The user is not associated with a trusted SQL Server connection.

Can anyone help?
Thanks.


sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-09-16 : 23:18:18
Change to Mixed Authentication in server properties.
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2009-09-17 : 00:51:50
Hi.
The same message when i try to log on as the user i created.In SQL server, haven't tried Vstudio cuz it does not work on the server to start with.

Server roles:
Public
security,server,sys - Admin
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2009-09-17 : 00:58:16
http://decipherinfosys.wordpress.com/2008/11/14/the-user-is-not-associated-with-a-trusted-sql-server-connection/
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2009-09-17 : 01:33:09
Oh.Will try tomorrow cuz i haven't slept all night with this and i'm exausted.
Will get back to you.
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2009-09-17 : 19:39:01
Ok, found it.Haven't applied a default database for my new login.
But i'm having a problem now.
IF p.e. i create a new login on the server, p.e. userx and then i select the database that i want to access and go to security to create a new user then i can only map to a login from the server(p.e. my new user x).So the question still stands on how to set a user or login to view a specific database.Any help or articles?
Thanks again.
Go to Top of Page

sapator
Constraint Violating Yak Guru

462 Posts

Posted - 2009-09-19 : 11:24:15
Hi.
After some testing i have managed some things.
So some questions.
1)To be able to restrict a login to a particular database you have to set "serverroles" as Public only?
2)The "default database" can be master or only the database you want?
Probably not a problem since you may want to access more than 1 databases,so i'm thinking this map to a default database is for the login to work only?
3)On user mapping you have to set to publc and dd_readed,db_writer?
With this the user can read,write but not delete tables or the DB?
4)What's the point of mapping a user to the database since it works with the login you create (an also a "user"(not a login) cannot login to SQL server, or am i doing-thinking something wrong?
Thanks.
Go to Top of Page
   

- Advertisement -