wood burning stoves
The moose likes JBoss/WildFly and the fly likes DB Connectoin Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "DB Connectoin Pool" Watch "DB Connectoin Pool" New topic

DB Connectoin Pool

Jotnarta Jot

Joined: May 18, 2006
Posts: 24
Hi All

I am developing a simple JEE web application, using MySQL database and JBoss AS on Eclipse IDE. I did create the connection pool parameter and I connected successfully to the database using connection parameters through ds-mysql.xml file in JBoss AS.

My question is, do I need to create a connection class as a skeleton, and pass this connection to other classes or pages to create sql Statement class? or does the connection pooling mechanism is in charge of manageing all the opended connections through the web application?

Please help, and thank you in advance

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Each time you ask for a connection from the connection pool, you are given an available connection. If the same thread (in a single request) asks for connections in multiple places, each will be a different connection. That is a good way to run out of connections very quickly and a good way to really confuse things because each connection handles its own database transaction. It is usually better to get a connection once, per request, and use only that one connection for all database work.

JBoss In Action
vikash mishra

Joined: Jun 16, 2009
Posts: 4

Can you please tell me, where you have done the setting for the connection pooling? Weathor it was done inside the mysql-ds.xml or jboss-service.xml as mbean or separate hibernate-service.xml in .har file?

Let me know what property and attribute was used for setting.

Thanks in advance.
Vikash Chandra Mishra
I agree. Here's the link: http://aspose.com/file-tools
subject: DB Connectoin Pool
It's not a secret anymore!