• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pooling database connections

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A friend warned me that JForum doesn't use ConnectionPool with the database, but obtains connections directly from the driver. This have an impact on performance (he compared to mvnforum, which is also Java).

I think that connection pooling is important, because a single database server may serve different applications, which share limited database connections.

So, why you don't use connection pooling and when it will be added?

Thanks!
Evgeny
[originally posted on jforum.net by Evgeny]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I *do* use connection pool. It is handled by ConnectionPool.java.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rafael,
I just looked at ConnectionPool.java and found these lines:

Connection conn = DriverManager.getConnection(this.connectionString);
this.connections.addLast(conn);
this.allConnections.add(conn);

Ok, you manage your own pool of connections, right?

Why don't you use Java javax.sql.DataSource which can manage its own pool of database connection. Isn't that better?

Thanks!
Evgeny
[originally posted on jforum.net by Evgeny]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DataSource is just a new way do get the connections, but you stil should have an datasource implementation, and in most cases is maps to DriverManager. The DriverManager works fine AFAIK.

However, in a near future, I've plans to start using XAPool ( http://xapool.experlog.com/ )

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rafael,

I think it's faster to start and better to use Tomcat connection Pooling, which can be easily configured via server.xml and such may effetively manage limited database connections resources in multiple web applications. Just an advice.

Thanks!
Evgeny
[originally posted on jforum.net by Evgeny]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Evgeny wrote:Rafael,

I think it's faster to start and better to use Tomcat connection Pooling, which can be easily configured via server.xml and such may effetively manage limited database connections resources in multiple web applications. Just an advice.

Thanks!
Evgeny



"Tomcat connection pooling" seems like we're considering that all users use Tomcat . And, if am not wrong, tomcat uses jakarta-pooling, which is a piece of crap.

There is c-jdbc also, to manage clusters of database servers, but currently I'll keep using my own connection pool. RC5 will come with an "ConnectionPool interface", so you may use any implementation you want to

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, actually connection pooling is configured via deployment descriptor, it is not Tomcat specific . Program should simply search a DataSource in the JNDI, not matter if it Tomcat, Resin, Weblogic or another container that provides objects in JNDI.


Thanks!
Evgeny
[originally posted on jforum.net by Evgeny]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Evgeny wrote:Well, actually connection pooling is configured via deployment descriptor, it is not Tomcat specific . Program should simply search a DataSource in the JNDI, not matter if it Tomcat, Resin, Weblogic or another container that provides objects in JNDI.


Thanks!
Evgeny



hehehe.. I got you point before ;)

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rafael Steil wrote:DataSource is just a new way do get the connections, but you stil should have an datasource implementation, and in most cases is maps to DriverManager. The DriverManager works fine AFAIK.

However, in a near future, I've plans to start using XAPool ( http://xapool.experlog.com/ )

Rafael



Why XAPool? why not the container default connection pool?
(Just trying to determine the best alternative)
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Why XAPool? why not the container default connection pool?
(Just trying to determine the best alternative)



XAPool as default, but you can use the pool provided by the container without problems. There is not default implementation for that, but all you need to do is to make a classe that extends net.jforum.DBConnection.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic