login failed for sql server

  • Thread starter Thread starter rbutch
  • Start date Start date
R

rbutch

guys, i cant figure this out. ive even hardcoded the user name in the connection string.
im an admin on the box, im the full fledged dbo on the instance on the server.
is anyone familiar with this.
it refers to null, but its definately in there.

here's the connection string:

workstation id=HQJ1759DX;packet size=4096;user id=coE7599;integrated security=SSPI;data source=HQJ1750C;persist security info=False;initial catalog=MY_DB


here's the error
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
I can't swear to it but I think using SSPI and a User Id are mutually
exclusive (someone please correct me if I'm wrong). I'd start by trying
to eliminating each in turn and seeing if one or the other succeeds.
Oh, and be sure the username and password are for a Sql user that has
permissions not a Windows user.

Also you didn't mention what kind of client this is running under. If
you are running under a web service, IIS, or an NT service you will see
interesting results when trying to use SSPI. The reason is that each of
the mentioned application types are not running as you but instead as
whatever identity their underlying service is running as. You may
already know that but I figured it was worth mentioning.

I also seem to remember having this issue if my Sql Server instance was
not setup to support Mixed security. You may want to check and see if it
does (seeing as how mixed is required if you want to go back and forth
between SSPI and specifying a logon and password).

Hope something in there helps.

Have A Better One!

John M Deal, MCP
Necessity Software
 
If by chance this is a web app, then the "trusted connection" is using the
ASPNET account and not yours.

To test, create a sql login for HQJ1750C\ASPNET and grant database owner
access to the MY_DB database.
 
I can swear to it :-)

Remove the "integrated security=SSPI;", and make sure SQL Server is
configured to allow both Windows and SQL logins

Jeff

John M Deal said:
I can't swear to it but I think using SSPI and a User Id are mutually
exclusive (someone please correct me if I'm wrong). I'd start by trying
to eliminating each in turn and seeing if one or the other succeeds.
Oh, and be sure the username and password are for a Sql user that has
permissions not a Windows user.

Also you didn't mention what kind of client this is running under. If
you are running under a web service, IIS, or an NT service you will see
interesting results when trying to use SSPI. The reason is that each of
the mentioned application types are not running as you but instead as
whatever identity their underlying service is running as. You may
already know that but I figured it was worth mentioning.

I also seem to remember having this issue if my Sql Server instance was
not setup to support Mixed security. You may want to check and see if it
does (seeing as how mixed is required if you want to go back and forth
between SSPI and specifying a logon and password).

Hope something in there helps.

Have A Better One!

John M Deal, MCP
Necessity Software
security=SSPI;data source=HQJ1750C;persist security info=False;initial
catalog=MY_DBASP.NET resources...
 
im sorry, i should have mentioned this was ASP.NET.
i have no problem at all using VB.NET on this server and sql server instance.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Exactly. ASP.NET runs under a different user account that your VB.NET
program. Follow my previous advice.

Jeff

rik butcher said:
im sorry, i should have mentioned this was ASP.NET.
i have no problem at all using VB.NET on this server and sql server instance.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
If you want SQL integrated security with your ASP.NET app, then add ASPNET
as a SQL login. Or run your ASP.NET app under a different user account, and
add that login.

Jeff

rik butcher said:
im sorry, i should have mentioned this was ASP.NET.
i have no problem at all using VB.NET on this server and sql server instance.

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
i appreciate all the help guys.
i guess whats frustrating is with a hard coded connection string.
i can run this successfully while developing it on my pc and i can put it in a virtual directory on my pc and it runs fine.
but, if i put it in anyother Virtaul Directory, even on the server itself that has the db, i get the Trust Error.
removing SSPI changed the msg from a NULL user to my user ID.
so, im still a little lost but, i did want to let you guys know i appreciate the guidance.
thanks
rik

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Did you try my suggestions?

You don't need to hard code a connection string when using Integrated
Security. But regardless the user needs a SQL login. You can create the
login in SQL Enterprise Manager.

Jeff

rik butcher said:
i appreciate all the help guys.
i guess whats frustrating is with a hard coded connection string.
i can run this successfully while developing it on my pc and i can put it
in a virtual directory on my pc and it runs fine.
but, if i put it in anyother Virtaul Directory, even on the server itself
that has the db, i get the Trust Error.
removing SSPI changed the msg from a NULL user to my user ID.
so, im still a little lost but, i did want to let you guys know i appreciate the guidance.
thanks
rik

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...
 
The ASP.NET application worker process (aspnet_wp.exe) runs using an account (ASPNET) with weaker privileges than the Local System account

Add the ASPNET Account in the Enterprise Manager and remove the "user id" in the connection string .


Regards,
 
Windows authentication does not send credentials over the network. If you use Windows authentication for a Web application, in most cases, you use a service account or a process account, such as the ASPNET account, to connect to the database. Windows and SQL Server must both recognize the account you use on the database server. The account must be granted a login to SQL Server and the login needs to have associated permissions to access a database.

When you use Windows authentication, you use a trusted connection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top