Today I've been hours reading Jonas' sources and I understand more about
Jonas DataSources. I found that
org.enhydra.jdbc.standard.StandardPooledConnection keeps a pool of
preparedStatements (by the way, jdbc 3 specifies that stuff). So, as
StandardXAConnections are StandardPooledConnections, I can expect to use the
same statement (if I get the same physical connection from the pool, of
course) even in different transactions (or non transactional contexts). Of
course, as you said, inside a transaction I can be sure to obtain always the
same physical connection and the same statements. Am I wrong?

Thank you,
    Carlos

----- Original Message -----
From: "Philippe Durieux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, February 27, 2001 5:44 AM
Subject: Re: PreparedStatements and connection pooling


> Carlos Pita wrote:
> >
> > Hi all!
> >
> > I need to execute the same SQL (parametrized) statement several times in
a
> > ejb but in different invokations of its methods. So I have 2 options, 1)
to
> > obtain a connection and keep it until removal (I don't want to do this)
or
> > 2) to close the connection after generating a PreparedStatement. So the
> > question is: if the connection was used to generate that statement, will
> > close() really return it to the pool? If it does, which connection (if
any)
> > is used to execute the statement?
> >
> > Thank you,
> >     Carlos
> If you close the connection, it will return to the pool and you will
> have to
> get a new one to execute a new statement. If you are inside the same
> transaction
> you will get the same connection. In fact, it is not really closed.
> A connection return to the pool only at the end of the transaction.
> I think that for what you want to do, keeping the Connection seems
> better.
> What Connection Manager do you use ? I mean what is the value of
> "datasource.factory" in your database.properties file ?
> The default ConnectionManager is used when this properties is not
> defined.
> Or you can use for example:
> org.objectweb.jonas.dbm.JonasStandardXADataSource
> to use an alternate Connection Manager.
> --
> Philippe Durieux  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Bull - 1 rue de Provence - 38432 Echirolles Cedex France
> [EMAIL PROTECTED]
> -> Download our EJBServer at http://www.evidian.com/ejb <-
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".
>


----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to