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.
| Author |
Topic |
|
SunnyDay
Starting Member
9 Posts |
Posted - 2007-10-14 : 03:08:36
|
I have created new login (SQL Server authentication type) and set my database as default database for it. Also I've added this user in user group of my database. BUt I cann't connect ussing this login. Error:Login failed for user 'LibraryUser'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)I've changed athentication mode to "SQL Server and Windows authentication mode" and restarted SQL Server, but nothing has changed PS: SQL Server 2005 Express Edition |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-14 : 03:31:14
|
http://www.carlprothman.net/Default.aspx?tabid=81www.connectionstrings.comHow do your connectionstring look like?Trusted connections can only be made with SSPI and domain user accounts.It seems you must change your connectionstrin to provide a username and a password for that particular user. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SunnyDay
Starting Member
9 Posts |
Posted - 2007-10-14 : 04:27:57
|
| Is it possible to get connection string in the text mode in SQL Server Management Studio?On creation the login in SQL Server Management Studio I've just 1. entered login name(LibraryUser), password, set SQL Server authentication, unchecked "Enforce password policy", set my database as default DB (on General page)2. checked my database name in list "Users mapped to this login"(on User Mapping page)Other settings I've remained without changes.THen I've added this login in users group of my database and set just only "Database role membership": db_datawriter, db_datareader, db_owner.Then I've tried to connect to server (local computer) in the same place - in SQL Server Management Studio:"Connect ot server" dialog box:Server type: Database EngineServer name: NEWCOMP\SQLEXPRESSAuthentication: SQL Server AuthenticationLogin name: LibraryUserPassword: ...I've not yet tried to connect by this logine to my database from C# code - I just want to confirm, that this connection configure properly and test it in Management Studio. Am I wrong with my actions? |
 |
|
|
SunnyDay
Starting Member
9 Posts |
Posted - 2007-10-14 : 13:24:02
|
| I've tried to connect from C# code on creating SqlConnection object:_connectionString="data source=NEWCOMP\SQLEXPRESS;User ID=LibraryUser;Password=qwerty;Initial catalog=Library;persist security info=False;"SqlConnection sqlConnection = new SqlConnection(_connectionString); try { sqlConnection.Open(); // it works, the connection state became opened InitializeDataSet(); // here table adapters calls Fill() methods for appropriate tables - an exeption has thrown } catch (Exception ex) { } finally { sqlConnection.Close(); }Exeption message:{"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}I cann't understand the 2 things:1. Why remote connection is needed? - I try to connect to local database! (if set "data source=(local)" in connection string - the same exeption would be trown during sqlConnection.Open();)2. Why Named Pipes Provider is used? |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-10-14 : 16:19:33
|
| Did you enable mixed authentication on sql server? Can you connect to sql with that id in sql tools? |
 |
|
|
SunnyDay
Starting Member
9 Posts |
Posted - 2007-10-14 : 17:09:51
|
| Yes, I set "SQL Server and Windows authentication mode".I can understand nothing! Now I can connect to login using this account. But connection from ASP.NET Web page (using this database) has still thrown an exeption! |
 |
|
|
SunnyDay
Starting Member
9 Posts |
Posted - 2007-10-14 : 17:11:58
|
| Just a correction:Yes, I set "SQL Server and Windows authentication mode".I can understand nothing! Now I can connect to Database Engine (in Management Studio) using this account. But connection from ASP.NET Web page (using this database) has still thrown an exeption! |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-10-14 : 20:20:39
|
| Tried connect to sql server in odbc on that web server? If doesn't work either, you may have network connection issue. |
 |
|
|
|
|
|
|
|