Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Jul 9, 1999

Accessing Database from Web Server

Question:

I have added a data connection in Visual Interdev. In the Data View I can see all my tables, fields and so on. My database resides on a SQL 7 server and my Web application is on the IIS 4 server. My problem is that I keep getting this error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e4d' 

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'SMIWEB\IUSR_SMIWEB'. 

/Test/Page2.asp, line 24 

I have this code on my ASP:

Set oRs=Server.CreateObject
("ADODB.Connection")

oRs.Open Application("Connection1_ConnectionString"),Application
("Connection1_RuntimeUserName"),Application("Connection1_RuntimePassword")
	
oRs.Execute ("Select * From tblDetail&qout)

Answer:

This is one of the most common mistakes made by programmers.

When you are developing, you can see all the tables of a database because you have an ODBC DSN (Data Source Name) set up on your computer. This is set up so that Visual InterDev can see the database.

When your application is running from a Web Server Computer, it is looking for the YOUR computer's DSN on the Web Server Computer. When it does not find one, it fails. You need to set up the same DSN on the Web Server computer. Test the DSN when you have created it to make sure the database can be accessed succesfully.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date