Spencer:

Thanks for this suggestion. YES! The Util class that
was designed EARLY in the project is called in the DAO
to create a connection. 
         con = Util.getConnection();
This created the connection. We found an error in this
Util class. In our DAO, if we need to run 3 different
operations with 1 call, we pass the Connection object
as a parameter so that 1 Connection can take care of 3
inter-related operations providing 3 different
database functions with the use of just 1 Connection,
thus trying to minimize the number of Connections
created. The Util class' method getConnection() used
to create a new Connection even if the DataSource was
not null. Hence, correcting the Util class to check
whether the DataSource is NOT null and to create a
Connection only if it was NULL, solved the problem of
creating Inactive connections.

Thanks TO ALL JDJLIST MEMBERS for ALL THE VALUABLE
suggestions you all provided. I really learn something
new everyday here!

Thanks and Regards,
Abhilash Nair




--- "Spencer W. Thomas" <[EMAIL PROTECTED]> wrote:
> The finally block should be executed, regardless of
> whether an exception 
> is thrown. Is it possible that you have a
> connection, but that the 
> variable "con" is null? Is it possible that there is
> a place that you 
> (or WebLogic?) are creating a connection that is NOT
> included in a 
> try...finally block?
> 
> =Spencer
> 
> Mark E. Zawadzki wrote:
> 
> >Are you sure that a SQLException is not being
> thrown, in some cases, w/in the
> >finally ? I see you do an empty catch. 
> >--- Abhilash Nair <[EMAIL PROTECTED]> wrote:
> >  
> >
> >>Hi All:
> >>
> >>We are using Oracle Thin Type 4 Driver with
> Weblogic
> >>App Server version 5.1 for our JDBC Connections
> and
> >>use Prepared Statements. We also have specified
> the
> >>maximum connections to be 100 in the weblogic
> >>properties and in our DAO's we close the
> >>PreparedStatement, ResultSet and Connection in the
> >>finally block. But there are STILL instances where
> the
> >>connections are not being closed even when the
> >>following code is executed:
> >>
> >>try{
> >>  //create connection,etc.
> >>}catch(SQLException sqlExc){
> >>  //handle error
> >>}finally{
> >>  try {
> >>     if(rs != null){
> >>       rs.close();
> >>     }
> >>     if(prepStmt != null){
> >>       prepStmt.close();
> >>     }
> >>     if(con != null){
> >>       con.close();
> >>     }
> >>  } catch(SQLException e) {;}
> >>}
> >>
> >>Problem faced: Exceeding the maximum number of
> >>connections due to inactive open connections. Has
> >>anyone faced this problem? 
> >>
> >>I thought that the finally block is executed no
> matter
> >>what and is the best place to close connections to
> >>ensure a proper clean - up! Can anyone please
> suggest
> >>what am I doing wrong here?
> >>
> >>Thanks in advance.
> >>Abhi
> >>
> >>__________________________________________________
> >>Do You Yahoo!?
> >>Yahoo! - Official partner of 2002 FIFA World Cup
> >>http://fifaworldcup.yahoo.com
> >>
> >>To change your membership options, refer to:
> >>http://www.sys-con.com/java/list.cfm
> >>    
> >>
> >
> >
> >=====
> >Mark Zawadzki Performance Engineer/DBA/Programmer
> extraordinaire'[EMAIL PROTECTED] 
> [EMAIL PROTECTED]"Programming today is a
> race between software engineers striving to build
> bigger and better idiot-proof programs, and the
> universe trying to build bigger and better idiots.
> So far, the universe is winningRobert Cringle
> (columnist, author, host of "Triumph of the Nerds")
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! - Official partner of 2002 FIFA World Cup
> >http://fifaworldcup.yahoo.com
> >
> >To change your membership options, refer to:
> >http://www.sys-con.com/java/list.cfm
> >  
> >
> 
> 
> 
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm


=====
You can reach me on:
Weekdays: (617)509-5312
Weekends and evenings: (781)321-2065
Pager: (781)553-8323
Thanks and Regards,
Nair Abhilash R
(Abhi)

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to