Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Restarting JDBC Connection Pool in a clustered Architecture

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on modifying my JDBC Connection Pool code to handle the situation where the database gets closed/bounced and reopened resulting in the loss of the Connection Pool. Without the code below I was throwing a Broken Pipe error, a Socket Write error, or a Connection Closed error.
The following block of code succeeds in rebuilding the connection pool in my testing environment which consists of one instance of WebLogic 7.0. The following block is the catch block of my getConnection method:
catch (Exception e){
//If the database goes down the connection pool is lost. Attempt to rebuild the connection pool.
String errorString = e.toString().toLowerCase();
if (errorString.indexOf("broken pipe")!=-1 || errorString.indexOf("socket write error")!=-1 || errorString.indexOf("closed connection")!=-1) {
try {
InitialContext ctx = new InitialContext();
MBeanHome mbeanHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);

WebLogicObjectName pname = new WebLogicObjectName("serverName", "ServerRuntime", mbeanHome.getDomainName());
WebLogicObjectName oname = new WebLogicObjectName(this.systemString.toLowerCase() + "Pool", "JDBCConnectionPoolRuntime", mbeanHome.getDomainName(),"serverName", pname);
JDBCConnectionPoolRuntimeMBean cprmb = (JDBCConnectionPoolRuntimeMBean)mbeanHome.getMBean(oname);
this.dl.logDebugMessage("Connection Pool Reset.");
dbConn = ds.getConnection();
this.dl.logDebugMessage("Getting a connection from dds - AFTER Connection Pool Reset.");
catch (Exception newE) {
My question is - What needs to be changed (if anything) when I move this out onto an architecute that consists of a cluster containing 2 servers. Do I need to reset the JDBCConnectionPoolRuntimeMBean on both servers? Reset the JDBCConnectionPoolRuntimeMBean on the cluster? I am most concerned with the "server Name" string and whether that needs to be the server name(s) or the cluster name.
I have little to no experience in working with clusters so my wording/questions may be flawed.
[ April 03, 2003: Message edited by: Tony Moses ][LIST]
[ April 03, 2003: Message edited by: Tony Moses ]
[ April 03, 2003: Message edited by: Tony Moses ]
Quick! Before anybody notices! Cover it up with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic