one of the application instance hang intermittently

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

one of the application instance hang intermittently

#1

Postby t4nu » Tue Sep 06, 2016 8:37 am

Hi,
I have 2 environments in 1 server.
Recently access to 1 environment intermittently got stuck and need service to be restarted.
When the user tried to wait the respond it will give this message:

Code: Select all

com.ebasetech.xi.exceptions.FormRuntimeException: Error getting connection using Database Connection JDE_DATABASE, SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection no connection available java.lang.Exception: GenericPool:checkOut ERROR impossible to obtain a new object from the pool
What should I do to prevent that to happen in the future?
0 x

Steve
Moderator
Moderator
Posts: 416
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Tue Sep 06, 2016 9:15 am

Hi,

This error is suggesting that you have a database connection leak. Somewhere in your scripts you are creating a database connection and not closing it in a finally.

Your code should look like this:

Code: Select all

var con = system.getDatabaseConnection("JDE_DATABASE");
var stmt;
var rs;
 try {
   stmt = con.prepareStatement("select * from tab1");
   rs = stmt.executeQuery();
   while (rs.next()) {
      var xx = rs.getString("col_name");
   }
 }
 finally {
   if (rs) rs.close();
   if (stmt) stmt.close();
   if (con) con.close();
 }
Note the important bits are:

1) Declaring the con, stmt and rs outside of the try statement.
2) Closing the result set, statement and connection in the finally.

Steve
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#3

Postby t4nu » Tue Sep 06, 2016 9:17 am

Thank you Steve,
Will try to hunt that part of code.
Actually I have done that, but still after I couldn't found anymore code that not close that problem mentioned before still arise.

Steve wrote:Hi,

This error is suggesting that you have a database connection leak. Somewhere in your scripts you are creating a database connection and not closing it in a finally.

Your code should look like this:

Code: Select all

var con = system.getDatabaseConnection("JDE_DATABASE");
var stmt;
var rs;
 try {
   stmt = con.prepareStatement("select * from tab1");
   rs = stmt.executeQuery();
   while (rs.next()) {
      var xx = rs.getString("col_name");
   }
 }
 finally {
   if (rs) rs.close();
   if (stmt) stmt.close();
   if (con) con.close();
 }
Note the important bits are:

1) Declaring the con, stmt and rs outside of the try statement.
2) Closing the result set, statement and connection in the finally.

Steve
0 x

Steve
Moderator
Moderator
Posts: 416
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Tue Sep 06, 2016 9:22 am

You can use the search Search Files to look for the text:

getDatabaseConnection

This option can be found in the designer on the main menu: Tools --> Search Files

Steve
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#5

Postby t4nu » Tue Sep 06, 2016 9:41 am

Yes, I use that tools and done it at least 3 times.
So far, all has the closing as you suggested.
May be I have try to re deploy the application to the server.
Steve wrote:You can use the search Search Files to look for the text:

getDatabaseConnection

This option can be found in the designer on the main menu: Tools --> Search Files

Steve
0 x

Steve
Moderator
Moderator
Posts: 416
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#6

Postby Steve » Tue Sep 06, 2016 9:50 am

OK, but if you are having problems still, then export your scripts and I will take a look to support@ebasetech.com

Steve
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#7

Postby t4nu » Tue Sep 06, 2016 10:28 am

OK will do.
I will try to search one more time, then re deploy the applicantion.
If the problem still exists I will send the support the exported script.
Thanks a lot for the help.
Steve wrote:OK, but if you are having problems still, then export your scripts and I will take a look to support@ebasetech.com

Steve
0 x


Who is online

Users browsing this forum: No registered users and 2 guests