Hello,
I have a super class like this :
public ConnectTools()
{
try
{
this.connexion(Constant.hostName, Constant.userName, Constant.passWord, Constant.drvrName);
}
...
It allows me to connect to a MySql database.
I have several classes that inherit from ConnectTools. And a child class implement another class...so that, each time I implement one class, I have several connections on mySql.
My questions:
- How can I transform my code to have only one connection on mysql?
- How can I deconnect from the database when the user quit the browser (because the thread keep running while the session isn't finished)
One idea is to put it on the HttpSessionBindingListener (bound)...but how can I keep the connection on mysql accessible.
Thank you for any help on this painful problem
H.
I have a super class like this :
public ConnectTools()
{
try
{
this.connexion(Constant.hostName, Constant.userName, Constant.passWord, Constant.drvrName);
}
...
It allows me to connect to a MySql database.
I have several classes that inherit from ConnectTools. And a child class implement another class...so that, each time I implement one class, I have several connections on mySql.
My questions:
- How can I transform my code to have only one connection on mysql?
- How can I deconnect from the database when the user quit the browser (because the thread keep running while the session isn't finished)
One idea is to put it on the HttpSessionBindingListener (bound)...but how can I keep the connection on mysql accessible.
Thank you for any help on this painful problem
H.