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".

Reply via email to