You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Brent Verner <br...@rcfile.org> on 2003/12/21 15:42:48 UTC

proposal for activationStatement and passivationStatement in PoolableConnectionFactory

  I've often had the need to perform some setup of a connection
before it can be used, such as:

  ALTER SESSION SET current_schema = workable_schema;

  As such, I've had a hacked version of dbcp around for a while
that adds an "activationStatement" and a "passivationStatement".
Both are fed thru the Statement.execute(String) method, and 
nothing is done with any (possible) ResultSet from the query.
These statements are executed in the activateObject() and 
passivateObject() methods (of PoolableConnectionFactory). If an
exception is thrown when executing either, a message is logged, 
and normal processing continues, i.e., a "bad" activationStatement
will not cause the connection to be considered "bad".

  If this is something that might be considered for inclusion 
in dbcp, please give me some feedback/comments on the notes 
above and I'll send a patch.

cheers.
  Brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DBCP] proposal for activationStatement and passivationStatement in PoolableConnectionFactory

Posted by Dirk Verbeeck <di...@pandora.be>.
I use bugzilla to track the enhancements as well as the bugfixes.
Simplifies making the release notes.

You cannot delete patches from bugzilla, so while it is a 
work-in-progress please use the mailing list, the final version can go 
into bugzilla.

-- Dirk

Brent Verner wrote:

> [2003-12-22 15:01] Dirk Verbeeck said:
> | Good start, but it will be really usefull when the new feature is 
> | available through the BasicDataSource. (and tested with JUnit test of 
> | course)
> 
> right on.  I'll update the patch to enable use via BasicDataSource.
> 
> I'm not well-versed in junit testing, so I might come back
> requesting help/suggestions...
> 
> | I have created a bugzilla issue to track this item:
> | http://issues.apache.org/bugzilla/show_bug.cgi?id=25696
> 
> thanks.  Should I use bugzilla and/or the mailing list when
> sending updated patches?
> 
> cheers.
>   Brent
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DBCP] proposal for activationStatement and passivationStatement in PoolableConnectionFactory

Posted by Brent Verner <br...@rcfile.org>.
[2003-12-22 15:01] Dirk Verbeeck said:
| Good start, but it will be really usefull when the new feature is 
| available through the BasicDataSource. (and tested with JUnit test of 
| course)

right on.  I'll update the patch to enable use via BasicDataSource.

I'm not well-versed in junit testing, so I might come back
requesting help/suggestions...

| I have created a bugzilla issue to track this item:
| http://issues.apache.org/bugzilla/show_bug.cgi?id=25696

thanks.  Should I use bugzilla and/or the mailing list when
sending updated patches?

cheers.
  Brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DBCP] proposal for activationStatement and passivationStatement in PoolableConnectionFactory

Posted by Dirk Verbeeck <di...@pandora.be>.
Good start, but it will be really usefull when the new feature is 
available through the BasicDataSource. (and tested with JUnit test of 
course)

I have created a bugzilla issue to track this item:
http://issues.apache.org/bugzilla/show_bug.cgi?id=25696

happy holidays...  o<]:-)

-- Dirk

Brent Verner wrote:

> [2003-12-21 21:36] Dirk Verbeeck said:
> | Yes this would be a nice feature, a couple of days ago there was 
> | somebody else requesting a similar thing on commons-user.
> | A patch is very welcome.
> 
> patch attached.  While cleaning this up, I realized that 
> activation/passivation was executed each time a pooled
> connection was borrowed.  This is not at all what I'd 
> originally intended...<blush />   As such, I've moved the 
> statement execution calls into makeObject() and destroyObject()
> where the do what I want (only once :-)).
> 
> | One remark, I would stop the normal processing when an exception is 
> | thrown. If needed you can always handle error in a PL/SQL block or 
> | stored procedure.
> 
> Ok. An SQLException is thrown on error.
> 
> cheers.
>   Brent
> 
> 
> P.S. I'll be slow to reply to email over the next couple of
>      weeks...  happy holidays!




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DBCP] proposal for activationStatement and passivationStatement in PoolableConnectionFactory

Posted by Brent Verner <br...@rcfile.org>.
[2003-12-21 21:36] Dirk Verbeeck said:
| Yes this would be a nice feature, a couple of days ago there was 
| somebody else requesting a similar thing on commons-user.
| A patch is very welcome.

patch attached.  While cleaning this up, I realized that 
activation/passivation was executed each time a pooled
connection was borrowed.  This is not at all what I'd 
originally intended...<blush />   As such, I've moved the 
statement execution calls into makeObject() and destroyObject()
where the do what I want (only once :-)).

| One remark, I would stop the normal processing when an exception is 
| thrown. If needed you can always handle error in a PL/SQL block or 
| stored procedure.

Ok. An SQLException is thrown on error.

cheers.
  Brent


P.S. I'll be slow to reply to email over the next couple of
     weeks...  happy holidays!

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Re: [DBCP] proposal for activationStatement and passivationStatement in PoolableConnectionFactory

Posted by Dirk Verbeeck <di...@pandora.be>.
Yes this would be a nice feature, a couple of days ago there was 
somebody else requesting a similar thing on commons-user.
A patch is very welcome.

One remark, I would stop the normal processing when an exception is 
thrown. If needed you can always handle error in a PL/SQL block or 
stored procedure.

-- Dirk

Brent Verner wrote:

>   I've often had the need to perform some setup of a connection
> before it can be used, such as:
> 
>   ALTER SESSION SET current_schema = workable_schema;
> 
>   As such, I've had a hacked version of dbcp around for a while
> that adds an "activationStatement" and a "passivationStatement".
> Both are fed thru the Statement.execute(String) method, and 
> nothing is done with any (possible) ResultSet from the query.
> These statements are executed in the activateObject() and 
> passivateObject() methods (of PoolableConnectionFactory). If an
> exception is thrown when executing either, a message is logged, 
> and normal processing continues, i.e., a "bad" activationStatement
> will not cause the connection to be considered "bad".
> 
>   If this is something that might be considered for inclusion 
> in dbcp, please give me some feedback/comments on the notes 
> above and I'll send a patch.
> 
> cheers.
>   Brent
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org