Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005

    Unanswered: Weird security exception

    We are getting a weird security exception from our log database recently. This does not happen consistently which is a major pain....

    .when our app logs into the db it uses the same connection string for all users including username and pwd.

    .when we insert/update a record in a table we use a trigger to insert an entry in a log table (in a log database).

    All works fine. But just lately we've start to intermittently get an exception: Server user 'emea\xxx' is not a valid user in database 'xxxLog'. (replacing sensitive info with xxx). Try a few times and it works eventually.

    I cannot find any reasonable explanation as to why this would suddenly be a problem. Any ideas?


  2. #2
    Join Date
    Jan 2003
    Provided Answers: 17
    Are folks using Office applications to get/update data in the database? These may be defaulting to a trusted connection, which would explain the NT usernames you are seeing.

  3. #3
    Join Date
    May 2005
    Nope, all the code is via our own custom apps. Any the ONLY connection string into the database is our one with the usename/pwd in it. This is totally strange and I did have your suspicions that our connection string is
    somehow bypassed in some situations but cannot see how.

    We do pass in the NT username to record what user actually changed/etc. a record but on our audit logs the UserChanged will always be our specific hard-coded user. (don't even bother telling me how messed up that is because I know!).

    Here is the full exception...

    Server user 'emea\xxx is not a valid user in database 'xxxLog'.

    Exception Type: System.Data.SqlClient.SqlException
    Errors: System.Data.SqlClient.SqlErrorCollection
    Class: 14
    LineNumber: 3
    Number: 916
    Procedure: xxx_U
    State: 1
    Source: .Net SqlClient Data Provider
    TargetSite: System.Data.SqlClient.SqlDataReader ExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean)
    HelpLink: NULL

    StackTrace Information
    at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
    at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

    where the xxx_U is a trigger on the xxx table that simply does an insert like...

    ([UserAction], [etc...], [CreatedBy], [CreatedDate], [LastModifiedBy], [LastModifiedDate])
    'U', inserted.[etc...], inserted.[CreatedBy], inserted.[CreatedDate], inserted.[LastModifiedBy], inserted.[LastModifiedDate]
    from inserted

    and the audit table matches the real table but has 3 extra fields...

    CREATE TABLE [xxx] (
    [UserAction] char(1) NULL,
    [UserChanged] varchar(255) NOT NULL DEFAULT (Suser_Sname()),
    [DateChanged] datetime NULL DEFAULT (getdate()),
    [CreatedBy] varchar(50) NOT NULL,
    [CreatedDate] datetime NOT NULL,
    [LastModifiedBy] varchar(50) NOT NULL,
    [LastModifiedDate] datetime NOT NULL) ON [PRIMARY]

    Any more ideas!?

Posting Permissions

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