473,425 Members | 1,615 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

SQL Server error '80040e31'

347 100+
I have the following page

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2.  
  3. <head>
  4. <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />
  5. <title>Time Data</title>
  6. </head>
  7.  
  8. <body>
  9. <% 
  10.  
  11. Set oConn = Server.CreateObject("ADODB.Connection")
  12. oConn.ConnectionTimeout = 120
  13. oConn.Open "Provider=SQLOLEDB; Server=xxxxx; Database=MDR; Uid=xxxxx; Pwd=xxxxx"
  14.  
  15. Dim rs
  16. Set rs = Server.CreateObject("ADODB.Recordset")
  17. SQL = "SELECT TOP 1 AVG(Zero) FROM mCallEnd WHERE (CallKind=0 OR CallKind=1 OR CallKind=16) AND Zero>0 AND OrgAccount=5127066669 AND Timestamp >= DATEDIFF(n, '12-31-1899', DATEADD(dd, DATEDIFF(dd,0,getdate()), 0))"   
  18. Set rs = oConn.execute(SQL)
  19.  
  20.  
  21. do while NOT rs.EOF 
  22. if rs.recordcount = 0 then
  23.     Response.Write "No records returned"
  24. else
  25.  
  26. Dim Zero_Sec
  27. Zero_Sec = rs("Zero")
  28.  
  29. Response.Write "Average “Zero” field since midnight: " & Zero_Sec %><br /> <%
  30. rs.MoveNext
  31. end if
  32.  
  33. Loop
  34. rs.Close
  35. Set rs = Nothing
  36. oConn.Close
  37. Set oConn = Nothing
  38.  
  39.  
  40. Set oConn2 = Server.CreateObject("ADODB.Connection")
  41.  
  42. oConn2.Open "Provider=SQLOLEDB; Server=xxxxxx; Database=MDR; Uid=xxxxx Pwd=xxxxx3"
  43.  
  44. Dim rs2
  45. Set rs2 = Server.CreateObject("ADODB.Recordset")
  46. SQL2 = "SELECT TOP 1 Zero FROM mCallEnd WHERE (CallKind=0 OR CallKind=1 OR CallKind=16) AND OrgAccount=5127066669 ORDER BY Timestamp DESC"   
  47. Set rs2 = oConn2.execute(SQL2)
  48.  
  49.  
  50. do while NOT rs2.EOF 
  51. if rs2.recordcount = 0 then
  52.     Response.Write "No records returned"
  53. else
  54.  
  55. Zero = rs2("Zero")
  56.  
  57. Response.Write "The actual Zero amount for the last account entry is: " & Zero %><br /> <%
  58. rs2.MoveNext
  59. end if
  60.  
  61. Loop
  62. rs2.Close
  63. Set rs2 = Nothing
  64. oConn2.Close
  65. Set oConn2 = Nothing
  66. %>
  67.  
and when I try to go to it, I receive the error 80040e31, I've reviewed several web pages pertaining to this and they all seem to talk about the connection string as being something that can cause this issue. Can someone please take a look at my connection string and see if this is what may be causing my issue with this page?

Thank you,
Doug
Nov 29 '10 #1
10 5503
ck9663
2,878 Expert 2GB
It could be a million things, including an invalid username and password, your sql server not allowing the connection, the user does not have the rights to the db, etc...

~~ CK
Nov 29 '10 #2
dougancil
347 100+
CK,

this page:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4. <head>
  5. <meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />
  6. <title>Time Data</title>
  7. </head>
  8.  
  9. <body>
  10. <% 
  11.  
  12.  
  13.  
  14. Set oConn2 = Server.CreateObject("ADODB.Connection")
  15.  
  16. oConn2.Open "Provider=SQLOLEDB; Server=10.2.1.41; Database=MDR; Uid=xxxxx; Pwd=xxxxxx"
  17.  
  18. Dim rs2
  19. Set rs2 = Server.CreateObject("ADODB.Recordset")
  20. SQL2 = "SELECT TOP 1 Zero FROM mCallEnd WHERE (CallKind=0 OR CallKind=1 OR CallKind=16) AND OrgAccount=5127066669 ORDER BY Timestamp DESC"   
  21. Set rs2 = oConn2.execute(SQL2)
  22.  
  23.  
  24. do while NOT rs2.EOF 
  25. if rs2.recordcount = 0 then
  26.     Response.Write "No records returned"
  27. else
  28.  
  29. Zero = rs2("Zero")
  30.  
  31. Response.Write "The actual Zero amount for the last account entry is: " & Zero %><br /> <%
  32. rs2.MoveNext
  33. end if
  34.  
  35. Loop
  36. rs2.Close
  37. Set rs2 = Nothing
  38. oConn2.Close
  39. Set oConn2 = Nothing
  40. %>
  41.  
  42.  
  43.  
  44.  
  45. </body>
  46. </html>
  47.  
produces a result on the same server, so I know it's not a permission issue but something wrong with the first query. Does that help in narrowing down a bit?

Thank you

Doug
Nov 29 '10 #3
ck9663
2,878 Expert 2GB
Get query from your first post and put it in your second post and run it. If it fails, your query is your problem, not the connection.

Good Luck!!!

~~ CK
Nov 29 '10 #4
dougancil
347 100+
CK,

I ran the query on the server itself and it took almost 2:45. I increased the time out in the page itself to 3600 seconds and still had the same issue. I know it's not the query because that works.
Nov 30 '10 #5
ck9663
2,878 Expert 2GB
Get the connection string on your second post and use it on your first post and see if it will work...

Good Luck!!!

~~ CK
Nov 30 '10 #6
dougancil
347 100+
I just tried the connection string from the second post and tried it ... still gave me a timeout.

here is the string that I tried:

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

oConn.Open "Provider=SQLOLEDB; Server=10.2.1.41; Database=MDR; Uid=xxxxx; Pwd=xxxxx

here is what it was:

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionTimeout = 120
oConn.Open "Provider=SQLOLEDB; Server=10.2.1.41; Database=MDR; Uid=xxxxx; Pwd=xxxxx"
Nov 30 '10 #7
ck9663
2,878 Expert 2GB
Then it's not your connection string.

Is 120 in minutes or seconds? If it's in seconds, that's just 2 minutes...You said your query runs for more than that... You might want to increase it some more...

Good Luck!!!

~~ CK
Nov 30 '10 #8
dougancil
347 100+
CK,

I posted this on entry #5:

I increased the time out in the page itself to 3600 seconds and still had the same issue. I know it's not the query because that works.

I believe that it's the query that's causing the issue here, but I have no way of decreasing the amount of time that it's taking to make the calculations that it's doing.
Nov 30 '10 #9
ck9663
2,878 Expert 2GB
Then let's optimize your query.
1. Do you have the proper index?
2. What's this: DATEDIFF(n, '12-31-1899', DATEADD(dd, DATEDIFF(dd,0,getdate()), 0)) for? As much as possible, avoid using function in your WHERE clause.
3. AVG is an aggregate function, no need to use TOP clause. It will always return a single record. Specially without the GROUP BY clause.

~~ CK
Nov 30 '10 #10
Hello,

80040e31 is for the timeout during the execution of the command not for the connection.
I am always using .Net Frameworks 3.5 or 4.0 with VB or VC#. I know that there is a commandtimeout. Maybe i am going wrong but it seems to me you are working with VB 6 and the "old" ADO . You should look in your documentation about a possible command timeout

Have a nice day

PostScriptum : Could you check whether there is a command timeout on the level of the server ( something like RemoteQueryTimeOut often set to 600 seconds ).
The DBA may have enabled the queries governor which limits the duration od a query.
Dec 8 '10 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: | last post by:
I am accessing the same error-containing ASP page on an ISP server using w2k IE6 but with different effect. On the first computer I get several line of HTML outputed by ASP, shown correctly by...
4
by: Patrick Masson | last post by:
Hello, Our configuration : Apache 2.0.53 PHP 5.0.4 PC Windows 2000 MATLAB 6.1 We work on a consulting project in France which involves MATLAB Web server,
6
by: Javier Cortés Cortés | last post by:
i am getting this error when i am trying to access any file(with the ext. aspx) from my remote server. the error is : Server Error in '/' Application....
0
by: Darren | last post by:
Hi, I get the above error message when I try to run my page on the remote server. As I am a newbie with .net, I chose Project | Copy to copy the files needed to a seperate local directory then...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
12
by: Kevin Farless | last post by:
Hi all, I'm having trouble viewing any .aspx pages on my hosting company's server. The server is a new box running Windows Server 2003 default installation. I'm the first client to try using...
5
by: Lara | last post by:
Hi, I am getting the following error. All the files are stored in a directory named 'web' as told by the Server Administrtor can anyone help me Server Error in '/' Application....
4
by: David Lozzi | last post by:
Howdy, I found a nice little book called ASP.NET 2.0 Cookbook by Michael A Kittel and Geoffrey LeBlond. Anyway, they have some instructions on how to setup application level error handling. Most...
5
by: James | last post by:
Hello, I have written a simple logon page that redirects to another page when successful. All works fine on my computer but when I upload it I get the error message below. I have written it...
4
by: Tonio Tanzi | last post by:
I have the following problem in a Win 2000 Server + SQL Server 2000 environment and I hope somewhat can help me to resolve it (after many days of useless attempts I am desperate). In my database...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.