db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Göschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: Release a connection
Date Thu, 22 Apr 2004 11:29:44 GMT
Hi Alexandru,

you should not close the connection directly since it is maintained by the connection pool.
And you might use Transaction.safeRollback() since it doesn't throw any further exceptions.
And you should configure the connection pool properly to check a connection before it is going
to be used ... 

Don't know about the JNDI stuff ... :-)

Cheers,

Siegfried Goeschl

-----Original Message-----
From: Alexandru Dovlecel [mailto:alexandru.dovlecel@siemens.com] 
Sent: Donnerstag, 22. April 2004 12:28
To: 'Apache Torque Users List'
Subject: Release a connection


Hi all,

I am using a connection pool defined by torque in the runtime config file (see end of message).
I want to implement a transaction using the objects generated by torque. So I create a java.sql.Connection
con = Transaction.begin( "transporter" ) ;

After executing the methods I call the Transaction.rollBack or Transaction.commit( con ) method.

QUESTION: DO I HAVE TO CLOSE THE CONNECTION??? Like con.close() ???

What if I'm going to use a DataSet exposed with the JNDI and referenced by torque? Do I have
to close the connection?

The code generated by torque does not close the connection. Is it correct?

Pls answer ASAP. Thanks,
Alex

Here is the config file:


torque.database.transporter.adapter=mssql
torque.database.transporter.driver=com.microsoft.jdbc.sqlserver.SQLServerDri
ver torque.database.transporter.url=jdbc:microsoft:sqlserver://localhost:1433;Da
tabaseName=mydb
torque.database.transporter.username=myuser
torque.database.transporter.password=mypwd

torque.dsfactory.transporter.factory=org.apache.torque.dsfactory.SharedPoolD
ataSourceFactory torque.dsfactory.transporter.connection.driver=com.microsoft.jdbc.sqlserver.
SQLServerDriver torque.dsfactory.transporter.connection.url=jdbc:microsoft:sqlserver://local
host:1433;DatabaseName=mydb torque.dsfactory.transporter.connection.user=myuser
torque.dsfactory.transporter.connection.password=mypwd


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message