Link to home
Start Free TrialLog in
Avatar of propractice
propractice

asked on

Login failed for user 'Administrator'. Reason: Not associated with a trusted SQL Server connection.

OK I'm getting the message:

Login failed for user 'Administrator'. Reason: Not associated with a trusted SQL Server connection.

I'm using windows authentication, how do I add this user so I can connect to the SQL DB from a different machine using this login.
Avatar of sigmacon
sigmacon

The administrative account on one windows machine is another then the administrative account on another machine unless you are in a domain. You need to run with whatever you trying to connect as a user that is configured to connect on the other server. How are you connecting? What is your client app?
My guess is that you're logged in to your workstation with its local Administrator logon.

If that is your intent, then you need to add the appropriate Windows group to the SQL server permissions.  It would probably be a Windows group called YourWorkstationName\Administrators.  If your intent is JUST to grant the Administrator logon rights, then add the single windows logon YourWorkstationName\Administrator to the SQL server.

If that is not your intent, then you need to log on to your workstation with a network ID that has rights on the SQL server, either itself or through group membership.
Avatar of propractice

ASKER

I'm using a connection string for asp.net
Does your asp.net application run under the administrator account?  You might want to be sure that's what you need.

Anyway, I'd suggest that you might want to configure a different account that has appropriately restricted rights on the SQL server and use it, with SQL Server security, to log your asp.net app into the database.
When using trusted connections make sure that the user account(s) from the alternate machine(s) that you are remotely connecting from has access (permissions) to the objects that you are accessing.  Just add them, adjust the permissions in SQL according to the functions that they will be performing (datareader only for selects, datawriter for updates/inserts, etc.)...  Hope this helps.
Well I made a new account called SQL_user on the SQL Server and added that as a user that had access to the database propractice.  But when i tried it from a different machine (tried running the code) it did not work.
Now you have to configure your asp connection to use SQL authentication and provide it with the name and password.
I remember there being an .ini file where in which you can supply the credentials.  I believe this was within the IIS framework directory.
Well I even tried just setting up a DSN then just using that, but it didn't work either :(

At one point I could just connect to it using enterprise manager that I installed on my laptop w/o a username/password?
Can you connect to the server with enterprise manager with the SQL_user you just created? If so, post the connection code you are using in your application, so we can debug it.
OK I get this error, (I just created a new user named propractice and I gave it access to the propractice adatabase)

Exception Details: System.Data.OleDb.OleDbException: Login failed for user 'propractice'. Reason: Not associated with a trusted SQL Server connection.

This is my connection string
:
"Provider=sqloledb;Data Source=TAPEBACKUP;Initial Catalog=propractice;User Id=propractice;Password=blah"
You have probably not got Mixed Mode security enabled in SQL.
How do I enable that?
right click the server in enterprise manager and click the security tab . you need to set it to Mixed (Sql + Windows authentication)
OK i tried that, still the same problem, I think perhaps it's interpreting the user as IUSR_machinename since i'm executing it from asp.. ?

But it doesn't make sense b/c it's the connection string
Are you using the SQLClient stuff in asp.net?
can you give ous the snippet of code that is making the connection?
I've tried both of these strings:

        ConnString = "Provider=sqloledb;" & _
                    "Data Source=TAPEBACKUP;" & _
                    "Initial Catalog=propractice;" & _
                    "User Id=propractice;" & _
                    "Password=sdfg"

        ConnString = "Data Source=TAPEBACKUP;" & _
                    "Database=propractice;Trusted_Connection=true;"

        Dim sqlConn As System.Data.SqlClient.SqlConnection
        Dim SqlCommand As System.Data.SqlClient.SqlCommand
        sqlConn = New System.Data.SqlClient.SqlConnection(ConnString)
        SqlCommand = New System.Data.SqlClient.SqlCommand(strSQL, sqlConn)

        sqlConn.Open()
looks ok to me.

? can you log into query analyser with these credentials ?
dunno didn't try....  I think it might have something to do with the fact that I'm on another machine?
ASKER CERTIFIED SOLUTION
Avatar of ShogunWade
ShogunWade

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial