Hi,
After switching my openfire server from a windows to a Linux server, I am facing a database problem in my custom plugin(The database I am using is an sql server)
My problem is that I am not able to close the database connection after opening it. And this will make an issue, since connecting more than 50k users on the server, will trigger my custom plugin, and will open more than 50k connection on the database without closing it.(So first of all I don't want to increase the number of connections more than 25, because It will lead to a leak in performance when opening more than 50k connection on the DB)
In my openfire admin page, under the database section I can see when no one is logged in to the server the following info :
Connections : 0 (active), 5 (available), 25 (max)
After some user logged in, and my plugin is triggered, the following info appears :
Connections : 27 (active), 0 (available), 25 (max)
and the server stopped.
Note that the same plugin was working fine on the windows server, when the connection was opened: 1 (active) ,and when the database connection is closed 0 (active) connections appears in the console.
The idea is that the db connections is closed well on the windows server, on the other side it's not behaving well on the Linux.
I am using the below code in my plugin when opening and closing the db connection:
try {
java.sql.Connection con=DbConnectionManager.getConnection();
proc_stmt = con.prepareCall("{ call dbo.SP_GET_CLIENT_MESSAGES(?) }");
proc_stmt.setString(1, ClientId);
rs = proc_stmt.executeQuery();
while (rs.next()) {
...............
.............
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
DbConnectionManager.closeConnection(proc_stmt, con);
}
Any idea how to solve this issue ?
Thanks in advance.