Re: Mysql suddenly stop all connections during operation
Posted by:
Hauke Betz
Date: October 12, 2006 12:30AM
Hello,
That's an issue with connection-pooling. The connections will be stored for future use. When closing the app (Just as the Query browser), the ressources will be released (Just like using Dispose() in C# or VB).
Sample code for using a single connection:
In the LoginForm, create a new Session variable (e.g. "DBConnection) and store the connection (I will use a variable "conDBConnection") use after loging:
(Code for LogOn)
...
Session["DBConnection"] = conDBConnection;
...
If you want to use the connection in another form, do the following:
public partial class SampleForm : System.Web.UI.Page
{
MySqlConnection conSiteConnection;
protected void Page_Load(object sender, EventArgs e)
{
conSiteConnection = (MySqlConnection) Session["DBConnection"];
...
}
private void FillGrid()
{
MySqlCommand MySQLTest = new MySqlCommand("SELECT * FROm sample",conSiteConnection)
...
}
Greets,
Hauke
Subject
Written By
Posted
Re: Mysql suddenly stop all connections during operation
October 12, 2006 12:30AM
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.