You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Steven Pannell <st...@zooplus.com> on 2006/01/04 14:59:54 UTC
make DB call for every new connection
Hi,
I want to set some session infomation for a connection I make using ibatis
on my oracle database. This works fine as follows:
client.queryForObject("setClientInfo",null);
executes a stored procedure and sets my session data. But there is a
problem. ibatis allows for multiple connections thus next time I make a DB
query I could get a new connection to oracle and thus my session infomation
is not set for that connection.
Is there a way around this problem, that everytime a new connection it made
using ibatis to my database it makes a call to my stored procedure. I want
a kind of new connection listener. Captures a connection has been made and
does something.
know what I mean?
thx.
Steve.
------------------------------------------------------------------------
Steven Pannell
Technical Project Manager
zooplus AG
Eichenweg 4 Rg.
85774 Unterföhring
Tel: +49 (89) 95006-163
Fax: +49 (89) 95006-500
steven.pannell@zooplus.com
http://www.zooplus.de
Re: make DB call for every new connection
Posted by Clinton Begin <cl...@gmail.com>.
This isn't an iBATIS problem so much as it is a connection pooling problem.
That is, you'd have the same problem with almost any connection pooling
solution (unless you were planning on holding connections open forever).
So the best way to deal with this is to tackle the problem at the source. I
would recommend implementing your own DataSource wrapper that will manage
whether connections are new or not, and run the procs if necessary.
The best solution though, would be to remove the requirement to set that
session data, that sounds pretty scary to me.
Cheers,
Clinton
On 1/4/06, Steven Pannell <st...@zooplus.com> wrote:
>
> Hi,
>
> I want to set some session infomation for a connection I make using ibatis
> on my oracle database. This works fine as follows:
>
> client.queryForObject("setClientInfo",null);
>
> executes a stored procedure and sets my session data. But there is a
> problem. ibatis allows for multiple connections thus next time I make a
> DB
> query I could get a new connection to oracle and thus my session
> infomation
> is not set for that connection.
>
> Is there a way around this problem, that everytime a new connection it
> made
> using ibatis to my database it makes a call to my stored procedure. I
> want
> a kind of new connection listener. Captures a connection has been made and
> does something.
>
> know what I mean?
>
> thx.
> Steve.
>
>
> ------------------------------------------------------------------------
> Steven Pannell
> Technical Project Manager
> zooplus AG
> Eichenweg 4 Rg.
> 85774 Unterföhring
> Tel: +49 (89) 95006-163
> Fax: +49 (89) 95006-500
> steven.pannell@zooplus.com
> http://www.zooplus.de
>
>
Re: make DB call for every new connection
Posted by Nathan Maves <Na...@Sun.COM>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Out of pure curiosity why would you do something like this. What
does it buy you?
Nathan
On Jan 4, 2006, at 6:59 AM, Steven Pannell wrote:
> Hi,
>
> I want to set some session infomation for a connection I make using
> ibatis
> on my oracle database. This works fine as follows:
>
> client.queryForObject("setClientInfo",null);
>
> executes a stored procedure and sets my session data. But there is a
> problem. ibatis allows for multiple connections thus next time I
> make a DB
> query I could get a new connection to oracle and thus my session
> infomation
> is not set for that connection.
>
> Is there a way around this problem, that everytime a new connection
> it made
> using ibatis to my database it makes a call to my stored
> procedure. I want
> a kind of new connection listener. Captures a connection has been
> made and
> does something.
>
> know what I mean?
>
> thx.
> Steve.
>
>
> ----------------------------------------------------------------------
> --
> Steven Pannell
> Technical Project Manager
> zooplus AG
> Eichenweg 4 Rg.
> 85774 Unterföhring
> Tel: +49 (89) 95006-163
> Fax: +49 (89) 95006-500
> steven.pannell@zooplus.com
> http://www.zooplus.de
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFDu/PWIctU6cqxUyYRAqLwAJ0QRFxB9oL2yevppZ2cxHoZUQCnawCfUQu0
Q2MKorDSnQSFv6C6dhPSdvw=
=y17k
-----END PGP SIGNATURE-----