unknown errors- ASP.NET w/ mySQL (ODBC)
Posted by:
james r
Date: October 23, 2004 06:14PM
i am at my wit's end trying to figure out problems i've been experiencing with an application that uses ASP.NET as its front-end (on one server) connecting to a separate backend mysql server using the MySQL ODBC 3.51 driver.
here's the debug information summary:
1) i know it's a problem with asp.net and odbc. i have two test pages running on the same web server- one in php and one in asp.net. when these problems start happening, the php page can continue accepting queries and connecting to the mysql server & database, and return valid results.
2) the application for the most part uses odbc connections to mysql to get recordsets that then get bound to datagrids.
3) the problem i am seeing (i am unsure if it is really load related, as it doesn't seem that it's any higher traffic than other times) is that at some point, the asp.net pages all stop getting the mysql results. code will be below, but i'm catching odbcexceptions and regular exeptions and the only message i get is:
'no information available'
talk about cryptic, huh?
target site is Void Open()
4) again, even when these errors stop occuring and the asp.net application gets bogged down, php pages on the same web server can still access mysql just fine, so i know it is not a problem with the mysql server itself, nor is it a problem with the web server in general. it is only asp.net. these problems continue until iis is restarted (i haven't found any other way to 'reset')
somebody PLEASE point out where i might be going wrong with the following code snippet and/or explain what might be going wrong!!!
sample code:
<code>
private void FillInfo()
{
OdbcConnection myConnection = new OdbcConnection(DRIVER={MySQL ODBC 3.51 Driver};Server=otherserver.hostcompany.com;database=sampledbname;UID=aspusername;PWD=asppassword);
string ownerSelect = "select * from owners where type = ?";
try
{
OdbcCommand myCommand = new OdbcCommand(ownerSelect, myConnection);
myCommand.Parameters.Add(new OdbcParameter("", "1"));
myConnection.Open();
OdbcDataReader myReader = myCommand.ExecuteReader();
someDataGrid.DataSource = myReader;
someDataGrid.DataBind();
myReader.Close();
myConnection.Close();
}
catch(OdbcException oex)
{
debugMessages.Text += "ODBC exception caught in " + Request.Path + " method FillInfo<br>\n";
debugMessages.Text += "source: " + oex.Source + "<br>\n";
debugMessages.Text += "message: " + oex.Message + "<br>\n";
debugMessages.Text += "errors: " + oex.Errors + "<br>\n";
while(oex.InnerException != null)
{
debugMessages.Text += "--------------------------------<br>\n";
debugMessages.Text += "inner exception: " + oex.InnerException.ToString() + "<br>\n";
}
}
catch(Exception ex)
{
debugMessages.Text += "exception caught in " + Request.Path + " method FillInfo<br>\n";
debugMessages.Text += "source: " + ex.Source + "<br>\n";
debugMessages.Text += "message: " + ex.Message + "<br>\n";
while( ex.InnerException != null )
{
debugMessages.Text += "--------------------------------<br>\n";
debugMessages.Text += "inner exception: " + ex.InnerException.ToString() + "<br>\n";
ex = ex.InnerException;
}
}
myConnection.Dispose();
}
</code>
Subject
Written By
Posted
unknown errors- ASP.NET w/ mySQL (ODBC)
October 23, 2004 06:14PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.