Hello,
I am using struts and postgres. I have configured my datasource using struct-config.xml file. In database bean for each method i am using
private void getConnection()
throws SQLException {
if (connection == null) {
connection = dataSource.getConnection();}}
and do the work and using
public void closeConnection() {
try {if (connection != null)
connection.close();}
catch(SQLException exception) {//exception}
connection=null;
dataSource = null;}
closing the connection.
***********************
I have 2 questions
Does this practice create performance problem?
If yes
Can someone tell me how to use connection pooling
Thanks in Advance,
- Girish
-
How to use connection pooling in struts (1 messages)
- Posted by: Girish Bapat
- Posted on: January 07 2005 03:17 EST
Threaded Messages (1)
- How to use connection pooling in struts by Kishore Senji on January 13 2005 00:53 EST
-
How to use connection pooling in struts[ Go to top ]
- Posted by: Kishore Senji
- Posted on: January 13 2005 00:53 EST
- in response to Girish Bapat
Hello,I am using struts and postgres. I have configured my datasource using struct-config.xml file. In database bean for each method i am using private void getConnection() throws SQLException {if (connection == null) {connection = dataSource.getConnection();}} and do the work and using public void closeConnection() { try {if (connection != null) connection.close();} catch(SQLException exception) {//exception} connection=null; dataSource = null;}closing the connection.*********************** I have 2 questionsDoes this practice create performance problem?If yesCan someone tell me how to use connection poolingThanks in Advance,- Girish
1)Using a pool definitely boots performance.
2) Did you specify the type of the DataSource to be that of the "org.apache.commons.dbcp.BasicDataSource"; if you did then the pooling is done for you.
http://struts.apache.org/faqs/database.html