Error 507 and Sum function

I have Sun Java ASP installed on a Solaris 10 system connecting to a MySQL 5.026 DB via an ODBC connection. All other code works, except one page where I get an Error 507, HTTP Error 507

The Web server encountered an unexpected error while communicating with the ASP service.

Please contact the server's administrator if this problem persists.

The error only persists when I use SQL code that sum's two numbers: as in select Region, sum(some_column) as Test group by Region

When I go to display this data on a web page, I get an error 507. If I use another aggregate function, such as count there are no problems. Any ideas on what is causing it? Here is a code snippet:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!--#include file="../../Connections/Conn.asp" -->

<%

Dim getTest

Dim getTest_numRows

Set getTest = Server.CreateObject("ADODB.Recordset")

getTest.ActiveConnection = DSLI_STRING

getTest.Source = "SELECT Region, sum(found) as Test FROM myTable group by Region"

getTest.CursorType = 0

getTest.CursorLocation = 2

getTest.LockType = 1

getTest.Open()

getTest_numRows = 0

%>

<%

Dim Repeat1__numRows

Dim Repeat1__index

Repeat1__numRows = -1

Repeat1__index = 0

getTest_numRows = getTest_numRows + Repeat1__numRows

%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>test</title>

<style type="text/css">

<!--

.style3 {font-size: small}

.style4 {color: #FFFFFF;

font-weight: bold;

}

-->

</style>

</head>

<body>

<table border="1" cellpadding="2" cellspacing="2" bordercolor="#000066" bgcolor="#FFFFFF">

<tr bgcolor="#000066">

<td width="11%"><div align="center" class="style4"><span class="style3">Type</span></div></td>

<td width="20%"><div align="center" class="style4"><span class="style3">Call Sign </span></div></td>

</tr>

<% While ((Repeat1__numRows <> 0) AND (NOT getTest.EOF)) %>

<tr bordercolor="#000066" bgcolor="#FFFFFF">

<td><%=(getTest.Fields.Item("Region").Value)%></td>

<td><%=(getTest.Fields.Item("Test").Value)%></td>

</tr>

<% Repeat1__index=Repeat1__index+1

Repeat1__numRows=Repeat1__numRows-1

getTest.MoveNext()

%>

<%Wend%>

</table>

</body>

</html>

<%

getTest.Close()

Set getTest = Nothing

%>

[2820 byte] By [chrisfont23a] at [2007-11-26 13:45:46]
# 1

By playing around with the SQL, I have found a "fix" - I put that in quotes, b/c I don't believe it is truly the answer...

If I change my SQL and cast the summation as a char such as:

SELECT Region, sum(cast(found as char)) as Test

FROM myTable group by Region

No error...

However, leaving it as

SELECT Region, sum(found) as Test

FROM myTable group by Region

Yields an error

Anyone venture a guess as to why this is happening? Any ideas if my "fix" is truly a fix?

chrisfont23a at 2007-7-8 1:20:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 2

Two issues

Mysql 5 is not officially supported so that could be causing the issue.

My guess is that you have a value of found which is a null or some other illegal value which can not therefore be summed although it should not cause a 507 error - however I have seen 507 errors before when I wouldn't expect them. The cast probably causes the return value to be spaces, which then gets equated to zero.

Try select region,sum(ifnull(found,0)) as test from mytable group by region

Duncan

Duncan_Berrimana at 2007-7-8 1:20:31 > top of Java-index,Web & Directory Servers,Web Servers...