Thanks, this is good, but I think part of my problem is that I don't know how I should be setting this up. There are so many options, but I'm not sure which one is the one I should use.
Main Topics
Browse All TopicsThis question has been asked in a couple of different ways, but I think I'll need to ask in my own way.
I'm trying to connect to a SQL server and can't figure out why I'm having problems. The Web server is Windows 2003 Enterprise, SQL server is 2000, running on the same box. I'm trying to work on importing data in to a Flash application. The VB code I'm using for a basic test is:
<%@Language=VBScript%>
<HTML>
<HEAD>
<TITLE>Home Page</TITLE>
</HEAD>
<BODY>
<P>This line from HTML</P>
<HR>
<P>Next line from ASP will work<BR>
if ASP extensions installed correctly:<BR>
<%
Response.Write "<B>From ASP</B>"
%>
<HR>
<P>Next line from ADO will work if a DSN named test_ds has been set<BR>
for the database named 'test_application'.</P>
<%
cst = "Provider=SQLOLEDB;" & _
"Data Source=JUMBO;" & _
"Initial Catalog=test_application;"
"Integrated Security=SSPI;" &_
"User Id=Administrator;" &_
"Password=password"
set conn = CreateObject("ADODB.Connec
conn.open cst
oRS.open cst
oRS.MoveFirst
Response.Write "<B>" & oRS("PeopleNameLast") & "</B>"
%>
<HR>
Finished test page</P>
</BODY>
</HTML>
When I run this I get the following error:
Microsoft OLE DB Provider for SQL Server error '80040e4d'
Login failed for user 'JUMBO\IUSR_JUMBO'.
/test_adob.asp, line 26
It's come up a few times in variations on that same theme.
Any idea what I'm doing wrong? I have the suspicion that something is incorrect in either the way I've set up the ODBC, or in how I'm handling the authentication. I've tried a bunch of different user names and passwords.
Which brings me to a related question, as part of the whole: I don't want to authenticate against "administrator," but I don't see where/how Windows 2003 handles creating new users, or what the relationship is between users registered with the system and access to the SQL db.
Any light you could shed would be much appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Make sure to attribute to your ASP account a privilege to access the DB server. For instance, create an AD domain account for your ASP service to run on and then create a login in SQL that points to that domain account. If your ASP service runs on a local machine account then make sure that account has sufficient privileges to access the db server...In your case 'JUMBO\IUSR_JUMBO' seems not to be referenced in the logins accepted by SQL Server...Hope this helps...
RE: "We have solved the SQL Server bit," with all due respect, I don't think that's been done at all! You pointed me to a 3rd party site without any indication of which string would be useful or any answers regarding the remainder of the question.
If I need to be more specific about anything, I surely will.
You might want to take a look at http://www.macromedia.com/
To quote from the page:
"These errors are generated if SQL Server does not accept the logon account and/or password being submitted. One possible reason could be that a corresponding SQL Server account has not been setup for the Windows NT account used to access the database. An example of an account used to access the SQL Server database could be the IUSR_computername account used by Internet Information Services (IIS) for anonymous access to ASP pages."
In that respect, one of the connection strings listed at the site noted by flavo should work. I haven't done one in a long time, but the one your using should be pretty close.
His suggestion of posting a pointer question in the Windows Server 2003 or IIS topic areas is a good one too. I'd also think about creating one in ASP as well.
Regards,
ep
Other than blind links and one suggestion re: SQL, I do not think you have been given the best information.
While it is true in your case that the SQL server is on the same box with the web server that is unusual. Normally the SQL box would be behind the IIS box, and may not be part of the AD. In either case, you need an account on the SQL server which has permissions for the database your web application will be using.
So first thing first...either you need a SQL account or a windows domain account for your web application. (Racimo alluded to this without providing details on what to do.)
Normally, your web application runs as a local machine account (JUMBO\IUSR_JUMBO) which has less permissions than the default guest account. So even if the SQL Server is running on the same machine, you probably can not give the BUILTIN\IUSR_JUMBO access to SQL Server.
If you can not assign a machine local account to SQL Server, then you will need a domain account or a SQL account.
If you decide to use a domain account... e.g. DOMAIN\IUSR_JUMBO, then after creating the account in AD, you will need to change IIS to run as that user and also give it permission for the SQL Server database. (A lot of work). Furthermore, I think it stinks, to let your web application run on a domain account. It just screams hack me. Of course someone will argue otherwise. I'll keep all my web applications running on low privilage machine accounts, thank you very much.
So, if you keep the local machine account, then you will need to create an SQL account for your web application. If you installed SQL Server without selecting mixed authentication, you may need to run through the setup again. It is much easier and keeps your web application isolated.
Since the example you gave is classic ASP, as far as I'm concerned there is only one applicable connection string.
Dim connectionString
connectionString = "Provider=SQLOLEDB;Server=
Where User ID and password are the SQL user and password.
You should only use OLEDB connections from a web page. OLEDB connections offer better performance and stability than ODBC. Refer to these Microsoft Knowledge Base articles: KB Q10191, KB Q10023. Also the ODBC driver is slower than a dog and was just written so MS could claim ODBC support.
This code will verify you can connect ... change the connection string and query to have real information:
Dim conn, rs, query, connectionString
connectionString = "Provider=SQLOLEDB;Server=
Set conn = Server.CreateObject("ADODB
conn.Open connectionString
query = "SELECT * FROM someTable;"
Set rs = conn.Execute(query)
if NOT (rs.BOF AND rs.EOF) then
while NOT (rs.eof)
response.write rs(0) & "<br>"
wend
end if
rs.close
set rs=nothing
conn.close
Set conn=nothing
>I am the system administrator! This is all running on a single machine. My goal is to get this all working between SQL and Flash, if I do it locally then I have to figure it'll work in the upload.
If this is going live on the Internet, you will definately want to separate things and if you go with a host, you will be separated and have a SQL login, not an integrated windows login. The ISP wouldn't run the risk of putting the SQL server on a IIS machine, not let you web app run in a domain account.
Okay, just to make a liar out of myself, I was able to assign the local machine account to a local SQL server on one of my development servers.
In enterprise manager running from the server I was able to browse and select the local IIS user.
Which let me do this: "Provider=SQLOLEDB;Server=
Also simple, and no domain account.
http://www.rodsdot.com/ee/
just to clarify why you're having the problem,
this part of the connection string you are using: Integrated Security=SSPI
says to the web server "use the credentials of the currently logged on user".
You DON'T need to specify a userid and password in the connection string for this connection type.
At the moment, what is being passed across is the IUSR account for that server, this is the anonymous account.
This means, that you have Anonymous authentication turned on for this site in IIS.
To get this connection going, you need to do one of two things,
1, grant the iusr account access to your database.
or
2. go into your IIS properties, turn OFF anonymous authentication and turn on Integrated Windows NT Authentication in the Security tab.
For an internet based system, where the database is most commonly located on a separate system, you need to use BASIC authentication, not integrated. Windows can't double-hop integrated authentication. The downsides of basic authentication are that it transfers the credentials in cleartext and it requires the user to enter their logon id and password once per session.
If you don't want to go down this path, get rid of the Integrated Security=SSPI section of your connection string, setup a sql userid and password and pass that along in the connection string.
hope this clarifies.
"... ...and said machine is not connected to the Internet, just running IIS locally..."
That MIGHT matter. Just remember that when you set up the DSN for your database (when you move to production), it wants to be a system DSN, not a user one. I've run into situations where a db is set up using a user DSN and everything works fine, but when the stuff is moved to production, it produces the error (or a similar one) you're getting -- which is why it's a good idea to get in the habit of using nothing but system DSNs.
ep
I'm with rdivilbiss on that one - bypass the DSN completely, if nothing else it just gives you another point of failure that isn't necessary anyway.
The differences between local and remote access are basically that the site becomes much less forgiving about authentication when it's on separate machines. Wouldn't hurt to setup a mini network (i.e. one other computer) and try hitting your site just so you have an idea how it's going to respond in a server-client scenario though. Any problems with the way authentication is setup will show straight away. Tools like Virtual PC or Virtual Server are great for cheap testing on a single machine.
Don't forget that your IIS logs are your friend :) Turn on logging for your site, including userid logging so you can see what's coming through with problematic requests. Default location for these will be c:\windows\system32\logfil
200 is success, 500 is bad and will usually show ADO errors with the status code, 401 is an auth issue, 404 is a missing page.
Let us know how you go.
IUSR????? DSN? You guys must be crazy.
In a production environment, you should NEVER allow IUSR access to SQL Server. This is the whole reason for using a login and password. DSN's are archaic, and slow. They also create more overhead on the server.
Raydot had the right idea to begin with, I don't see why anyone would chastise him for his current topology.
I develop against a local SQL Server as well. I also ensure that my connection string is dynamic, so that no matter where my file is, it will execute the correct connection string. If you want to use only one connection string, it's trivial to just create the same SQL login on the development server, so that once files are moved over, you shouldn't see a difference. I could go into lengthy detail on all the possible solutions, but with all the solutions already posted, there is no reason confusing someone, who basically almost had it right the first time
Use something like this:
Dim oConn, ConnString
Dim serverIP as string = request.serverVariables("L
If serverIP = "Your Dev Machine IP address" Then
ConnString = "Local SQL Connection String"
Else
If serverIP = "Your Host IP" Then
ConnString = "Your Host IP ConnectionString"
End If
set oCconn = CreateObject("ADODB.Connec
oConn.open ConnString
nihannet,
While you may have valid comments yourself, I think perhaps you should read through the entire thread before criticising comments made by others.
Speaking for my own comment, I was explaining why, at the present time, the IUSR account (anonymous account) is the one that is being passed instead of integrated credentials.
I wasn't saying it SHOULD be used, I was saying it WAS being used and what exactly it was in the IIS configuration that was causing this to happen and how to correct it.
Thanks alimu. Sorry I didn't read your post thoroughly enough. You're right about why it was causing the problem. I read many posts on this site, and sometimes, people just get caught in the crossfire. I've seen some fairly bad advice posted on this site by some people. Usually it's all about "points" which personally....I have no clue as to what they're for, and could really care less. It's the content that matters, and as long as you steer someone in the right direction, you're ok in my book.
As for the "other" subject...I've been a member of this site for 9 years, and this very type of misunderstanding has been more or less my constant complaint since I joined. (You'll notice my taking issue along these same lines somewhat earlier in this very thread!) It's tough, people have only so much time, and on the Internet are only so motivated to care. I don't mean any of you specifically, it's just an interesting problem in developing an online community.
What to do, what to do...
localhost, is it localhost? That seems to be working but I get this error running the SQL query rdivilbiss gave me. The page takes 10 seconds to load and then:
Response object error 'ASP 0251 : 80004005;
Response Buffer Limit Exceeded
/test_adob.asp, line 0
Execution of the ASP page caused the Response Buffer to exceed its configured limit.
There are maybe 10 items in the table.
I guess I don't know if it's working or not!
Raydot,
Server=server means the name of the SQL server. Assuming it's located within the same network that is hosting your IIS server, it will probably be a single word. Also, instead of Database=table, it should probably be database=database_name. So your connection string would look like:
connStr = "Provider=SQLOLEDB;Server=
See http://www.experts-exchang
The Response Buffer Limit Exceeded error usually refers to the file size; there's a configuration item in ISS that lets you change it.
http://www.experts-exchang
ep
Thanks Ericpete. Maybe I haven't been clear enough. I basically used this script, provided above. The marked areas are the ones that don't seem to be executing. I started without that part, and then just added them in at the end to see if I could test that I was properly connected, and that didn't work.
Dim conn, rs, query, connectionString
connectionString = "Provider=SQLOLEDB;Server=
Set conn = Server.CreateObject("ADODB
conn.Open connectionString
query = "SELECT * FROM someTable;"
Set rs = conn.Execute(query)
'THIS DOES NOT WORK FROM HERE***
if NOT (rs.BOF AND rs.EOF) then
while NOT (rs.eof)
response.write rs(0) & "<br>"
wend
end if
'TO HERE ***
rs.close
set rs=nothing
conn.close
Set conn=nothing
There are literally 11 lines in the tables, 6 items per line, so I can't beleive that's outside of MSSQL's operational limit.
Business Accounts
Answer for Membership
by: flavoPosted on 2006-02-03 at 09:24:02ID: 15865486
Hi Raydot,
gs.com/
You are using Windows Authentication with a username and pw.
Have a look here for connection string help:
http://www.connectionstrin
Dave :-)