BEA Logo BEA WebLogic Server Release 6.1

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

  |  

  WebLogic Server Doc Home   |     FAQ   |   Previous Topic   |   Next Topic   |   Contents   |   View as PDF

FAQs: WebLogic JDBC

 


Can I enable requests to a JDBC connection pool for a database connection to wait until a connection is available?

No, there's no way to allow a request to wait for a pool connection, and from the system point of view there should not be. Each requests that waits for a connection ties up one of the fixed number of execute threads in the server, which could otherwise be running another server task. Too many waiting requests could tie up all of the execute threads and freeze the server.


How can I avoid ResourceExceptions when sending more requests for database connections from the pool than are currently available?

The fundamental problem is too few resources (database connections in the connection pool) for the work load. The correct response is to increase the maximum number of connections in the connection pool. Optimally designed applications only require the server to have one pool connection per execute thread.

The proper application response to a resource exception is not to retry the request in a tight loop, which would tie up execute threads on the server.

You should design your application to gracefully fail if no connections are available. Try to ensure that you get the connection as late as possible in your application code and return them to the pool as early as possible so that you do not see as many NoResource exceptions. It is better to have the connection as a method level variable and close the connection in a finally block as in the following example:

try{ 
  ...
} catch(Exception handleEx) {
  ...
} finally { 
  try{ conn.close(); 
}catch (Exception ignore){} // always return the connection to pool
} 


When should I use MultiPools?

If you are using WebLogic Server in a single-server configuration, you can use MultiPools in one of two ways 1) as a backup MultiPool in the event a database connection fails, or 2) as a load balancing MultiPool. Because you can choose only one option, you need to determine the primary purpose of your MultiPool. For more information, see Using Multipools in the Configuring WebLogic JDBC Features section of Programming WebLogic JDBC.


How can I tell if a database is unavailable?

Fundamentally, there is no way to tell if a database has gone down except by trying to make a connection and failing.

Furthermore, a database can become unavailable at any time after you make and use a connection. We recommend that you write your code to be able to handle unexpected failures, which can come in any form depending on what the client is doing when the database goes down. For more information, read about Connection Pools and Multipools in the Configuring WebLogic JDBC Features section of Programming WebLogic JDBC.

 

back to top previous page next page