Results 1 to 16 of 16
  1. #1
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    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.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Sounds like a question for an MS forum.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    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.

  4. #4
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote 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.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    Right click on the security bit in the object explorer on the left and choose New->Login.

  6. #6
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote 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.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    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.

  8. #8
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote 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 11:35 AM.

  9. #9
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    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?

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    Can you login to the management console with that user (rather than win-auth)?

  11. #11
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote Originally Posted by Tolls View Post
    Can you login to the management console with that user (rather than win-auth)?
    Yes I can....

  12. #12
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote 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 ?

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default

    Then your connection in Java is wrong somehow.
    Typo, something.

    In fact, remove the single quotes around the password....

  14. #14
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Quote 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.

  15. #15
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote 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.

  16. #16
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote 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.

Similar Threads

  1. Connect to SQL server 2005
    By comp in forum JDBC
    Replies: 1
    Last Post: 03-26-2009, 12:25 AM
  2. hibernate support for sql-server 2005
    By javadev in forum JDBC
    Replies: 2
    Last Post: 06-25-2008, 02:48 PM
  3. Replies: 4
    Last Post: 05-21-2008, 07:55 AM
  4. Java connecting to sql server 2005
    By pelegk2 in forum JDBC
    Replies: 0
    Last Post: 04-05-2008, 10:17 PM
  5. SQL Server 2005 Jdbc connection
    By mgt83 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-27-2007, 05:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •