struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Compagner" <jcompag...@j-com.nl>
Subject GenericConnection.close() -> Test before setting before resetting to default.
Date Wed, 07 Feb 2001 14:21:44 GMT
Hi,

I use the JDBCODBC driver at this time to a Access DB (just in the
development fase)
And i have build in a PreparedStatement Connection pool.
So that connection.preparedStatement returns a pooled one instead of
creating new ones all
the time. in the Close() of my GenericPreparedStatement class i return it to
the pool of the
GenericConnection.
But when the GenericConnection is closed. the close() method of
GenericConnection
just set's the default values like this: (and for readonly, ect ect)

 try
 {
   conn.setCatalog(this.catalog);
 }
 catch (SQLException e)
 {
  ;
 }

The problem is that when i set the Catalog even it is not changed i can't
use my
PreparedStatements anymore, the next time i use one after thet setCatalog
call i get
a exception: Function Sequence Error

So what i did for all the default params is first test it if it is changed:

 try
 {
  if(!conn.getCatalog().equals(this.catalog))
  {
   conn.setCatalog(this.catalog);
  }
 }
 catch (SQLException e)
 {
  ;
 }

Can struts do the same?
Why resetting a default property if it isn't changed?

I attached my GenericConnection and all the classes that are added and
changed for the
preparedStatement Pool. Maybe this is something for struts?

By Default nothing is cached or pooled because the CacheStatements boolean
of the
GenericDataSource i added is false.
It would be nice if i could set that property in the struts-config.xml file
in the datasource section.


Johan




Mime
View raw message