Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp to sql server

Status
Not open for further replies.

mooniron

Programmer
Dec 15, 2002
26
TR
Thank miq. I did all you said. I was able to connect through visual basic using ado. But I want to connect when in asp pages.
For example I use:
conn="Provider=SQLOLEDB.1;Initial Catalog=myDatabase;Data Source=Server;UID=myLogin;pwd=" connection string and:
It returns:
---Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
Login failed for user 'myLogin'. Reason: Not associated with a trusted SQL Server connection.---
error.....................................
I am trying to connect from client computer to server computer(two computers).
Thanks again.

 
Make sure that the Data Source is set to the name of the server that your database resides on. Then make sure that the initial catalog is set to your database and that the username and password have access to that database.... -----------------------------------------------------------------
"The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'."
- unknown

mikewolf@tst-us.com
 
Hey mooniron,

I'm not sure what steps you went through, but when I built a web server to connect through ASP I had to do the following:

1. Make sure the firewalls have the appropriate ports open between the web server and the db server (I think the 80004005 error means you've actually talked to the db server, so that's a good thing).

2. Create the DB user you want to use from the web server, give it the appropriate permissions and the password you want to use.

3. This step may be superfluous, but I did it anyway. Add a matching user to the DB server and the web server - make the password the same as the db user. Make sure you document all of the users involved well so if you get hit by a bus and suddenly things don't work, someone else knows to check the user passwords are all in sync.

4. On the web server, create the ODBC connection Data Source (Control Panel> Data Sources (ODBC) in NT4). I created a System DSN. Under server name I put IP. Use SQL Server authentication, and set the client to TCPIP. I set the computer name and server alias as the IP to be sure, and left the port number as standard 1433.

5. Also on the web server, make sure that the anonymous user account (if you are allowing anonymous authentication) is the local user you created to match the DB user. Make the password match. In IIS, I disabled the automatic password syncronization - the pwd shouldn't change anyway.

That's what I went through to make it work. As far as troubleshooting, make sure SQL Server is logging account login failures, and check the event log to see if your problem is with SQL authentication or windows authentication. I'm not 100% sure how the authentication is working here, but it seems as if my web server needed to somehow authenticate to windows as well (although they're only allowed to communicate on 1433 so I'm not sure how that happens).

At any rate, I hope this is helpful!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top