Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-10-2010, 07:16 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Smile SQL server 2005 - Login failed message
Hi All, could you please help me ?

I'm trying to connect to SQL server 2005 express edition but I've got this error message:

Login failed for user 'PC346519167106\Patricia e Pierre'. The user is not associated with a trusted SQL Server connection.
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'PC346519167106\Patricia e Pierre'. The user is not associated with a trusted SQL Server connection.
at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF (Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unkno wn Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.s endLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.l ogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.a ccess$000(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$L ogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Un known Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.e xecuteCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.l oginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DBCON.main(DBCON.java:32)


I'm using on SQL server 'window authentication' to connect and when I start my PC I'm using a 'PC administrator' user.

Where in SQL server can I manage users accounts ?

Thanks a lot guys !

Pierre.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 02-10-2010, 07:54 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
Sounds like a question for an MS forum.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-10-2010, 09:11 AM
Senior Member
 
Join Date: Apr 2009
Posts: 2,107
Rep Power: 4
Tolls is on a distinguished road
Default
Have you got Management Studio Express?
Create a user through that, and give it whatever privileges it needs to work with the db you want it to.
I have never used windows authentication to connect. I've always had a "proper" user.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 02-10-2010, 09:24 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by Tolls View Post
Have you got Management Studio Express?
Create a user through that, and give it whatever privileges it needs to work with the db you want it to.
I have never used windows authentication to connect. I've always had a "proper" user.
Thanks a lot man,

Yes i've got the Management Studio Express and I will try to find how to do this(create new user on sql server express).

Best Regards, Pierre.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 02-10-2010, 10:01 AM
Senior Member
 
Join Date: Apr 2009
Posts: 2,107
Rep Power: 4
Tolls is on a distinguished road
Default
Right click on the security bit in the object explorer on the left and choose New->Login.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 02-10-2010, 10:05 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by Tolls View Post
Right click on the security bit in the object explorer on the left and choose New->Login.
Thanks again man !!!

Well, I've just created a new user with all grants.....but I still have this error message:

Login failed for user 'pbaudru'. The user is not associated with a trusted SQL Server connection.
(Microsoft SQL Server, error: 18452)

How can I avoid this please ?

Something still need to be donne on login configuration ?

Regards. Pierre.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 02-10-2010, 10:15 AM
Senior Member
 
Join Date: Apr 2009
Posts: 2,107
Rep Power: 4
Tolls is on a distinguished road
Default
Forgot this bit...

Though that doesn't explain why you got that error the first time, unless your connection string in your code was such that it thought you were using a login rather than win-auth.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 02-10-2010, 10:33 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by Tolls View Post
Forgot this bit...

Though that doesn't explain why you got that error the first time, unless your connection string in your code was such that it thought you were using a login rather than win-auth.
Thanks man,

I changed to 'mixed mode', but still have a similar error. Note that the 'The user is not associated with a trusted SQL Server connection.(Microsoft SQL Server, error: 18452)' is not in the message anymore....

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'pbaudru'.
at com.microsoft.sqlserver.jdbc.SQLServerException.ma keFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF (Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unkno wn Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.s endLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.l ogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.a ccess$000(Unknown Source)Login failed for user 'pbaudru'.

at com.microsoft.sqlserver.jdbc.SQLServerConnection$L ogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Un known Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.e xecuteCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.l oginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.c onnect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DBCON.main(DBCON.java:28)


I logged in SQL server with the pbaudru user this time....or do I need to login with the windows login ?

Here is part of code I'm using:
String connectionString = "jdbc:sqlserver://localhost;database=eureka;user=pbaudru;"
+ "password='testlogin'";

conn = DriverManager.getConnection(connectionString);


Regards. Pierre.

Last edited by pbaudru; 02-10-2010 at 10:35 AM.
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 02-10-2010, 10:34 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
That means that either the user doesn't exist or you used the wrong password.

Edit: I mean, you do, normally, know what "login failed" means, don't you?
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 02-10-2010, 10:43 AM
Senior Member
 
Join Date: Apr 2009
Posts: 2,107
Rep Power: 4
Tolls is on a distinguished road
Default
Can you login to the management console with that user (rather than win-auth)?
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 02-10-2010, 10:44 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by Tolls View Post
Can you login to the management console with that user (rather than win-auth)?
Yes I can....
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 02-10-2010, 10:45 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by masijade View Post
That means that either the user doesn't exist or you used the wrong password.

Edit: I mean, you do, normally, know what "login failed" means, don't you?
yes but what is missing to the user config to be good man ?
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 02-10-2010, 10:55 AM
Senior Member
 
Join Date: Apr 2009
Posts: 2,107
Rep Power: 4
Tolls is on a distinguished road
Default
Then your connection in Java is wrong somehow.
Typo, something.

In fact, remove the single quotes around the password....
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 02-10-2010, 10:57 AM
Member
 
Join Date: Jan 2010
Location: Athus - Belgium
Posts: 23
Rep Power: 0
pbaudru is on a distinguished road
Send a message via MSN to pbaudru Send a message via Skype™ to pbaudru
Default
Originally Posted by Tolls View Post
Then your connection in Java is wrong somehow.
Typo, something.

In fact, remove the single quotes around the password....
yes yes yes man.....I'm connected....thanks a lot man !!!

Best regards !!! Pierre.
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 02-10-2010, 10:59 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
Originally Posted by pbaudru View Post
yes yes yes man.....I'm connected....thanks a lot man !!!

Best regards !!! Pierre.
Better, of course, would be to use the three argument version of getConnection so you don't have to worry about that sort of url syntax.
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 02-10-2010, 11:03 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
Originally Posted by pbaudru View Post
yes but what is missing to the user config to be good man ?
Well look at your connection code and think about what you've entered there. What, just might, be the problem. Change that and try again. It takes 10 seconds. Instead you post again on a site, what until someone happens to see it, and feels like answering, and you happen to see that it has been answered, and then do that anyway, if anyone was "kind" enough to point out the mistakes that should be, at least somewhat, obvious. Which, of course, all takes alot longer.

IOW, use a little initiative and use that thing on your neck for something other than keeping your feet from floating away.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect to SQL server 2005 comp Database 1 03-25-2009 11:25 PM
hibernate support for sql-server 2005 javadev Database 2 06-25-2008 01:48 PM
Having problem in connecting with SQL Server 2005 rmaadil Database 4 05-21-2008 06:55 AM
Java connecting to sql server 2005 pelegk2 Database 0 04-05-2008 09:17 PM
SQL Server 2005 Jdbc connection mgt83 JavaServer Pages (JSP) and JSTL 0 07-27-2007 04:52 AM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 09:22 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org