-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Shared c3p0 pool in managed environment?
PostPosted: Thu Jan 05, 2006 5:39 am 
Newbie

Joined: Tue Oct 25, 2005 6:04 am
Posts: 10
I have a small special-purpose application server that uses hibernate in a managed environment scenario. The server has has hibernate and libraries in classpath, and loads modules using separate classloaders. Each module initializes hibernate:

Code:
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Configuration cfg = new Configuration();
cfg.setProperties(moduleProperties);
// add module specific persistent classes      
sf = cfg.buildSessionFactory();

a typical moduleProperties looks like this:

Code:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/modulesDatabase
hibernate.connection.username=user
hibernate.connection.password=pass
hibernate.c3p0.min_size=1
hibernate.c3p0.max_size=5
hibernate.c3p0.timeout=1800
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.show_sql=false

This way modules all use the same hibernate classes, but have their isolated view of the database and everything.

My problem is that the modules grew quite a few over time, and now I have tons of separate connections to the database server with very low concurrency. All modules connect to the same database server, but access different databases.

Is it possible to make somehow all modules request connections from the same c3p0 pool, and have them change the current database before issuing any requests? If this could be done, I would have a single pool with a few connections that would be used more efficiently.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.