You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Joan Miralles <jm...@brujulatelecom.com> on 2005/02/02 10:07:43 UTC

Connection pool duplication

Hi,

First, sorry for my very bad English. ;)

I'm new user in OJB, and I have a problem with connection-pool. I'm
using an environment with EJB and OJB.
To obtain a broker in a DAO class that only execute queries I'm using a
singleton class (ServiceLocator):

PersistenceBroker broker = ServiceLocator.getInstance().findBroker();

The method findBroker() is:

public PersistenceBroker findBroker() throws ServiceLocatorException {
   PersistenceBroker broker = null;
   
   try {

      broker =
PersistenceBrokerFactoryFactory.instance().defaultPersistenceBroker();
          
   } catch (PBFactoryException e) {
      e.printStackTrace();
      throw new ServiceLocatorException("PBFactoryException error
occurred while parsing the repository.xml file in ServiceLocator
constructor", e);
   }
   return broker;
}

When I need to execute an store in DB, I'm using EJB. To obtain a broker
when I use EJB method, I'm using OjbStartup class.

PersistenceBroker broker =
ojbPbFactory.getInstance().defaultPersistenceBroker();

OjbPbStartup is the same that there is into:

http://db.apache.org/ojb/docu/guides/deployment.html

The problem is that when I obtain a broker with OjbPbStartup class, the
appServer opens 10 connections more (parameter minConnections in
datasources.xml), and then I have 20 connections to the DB when I only
want to have 10.

I don't know if I explained me well.

Thanks for any help,

Joan Miralles Ramis




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


Re: Connection pool duplication

Posted by Thomas Dudziak <to...@gmail.com>.
Are you sure this is a problem of OJB ? I don't know the
com.evermind.sql.DriverManagerDataSource, but you might want to try
other data sources, e.g. the poolable oracle datasource or
commons-dbcp, to see whether the problem occurs with them too.

Tom

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


RE: Connection pool duplication

Posted by Joan Miralles <jm...@brujulatelecom.com>.
Hi, Thomas.

I'm using OJB version 1.0.0 (db-ojb-1.0.0.jar).

Datasources.xml

    <data-source
		class="com.evermind.sql.DriverManagerDataSource"
		name="srvOracleDS"
		location="srvOracleDS"
		xa-location="srvOracleXADS"
		ejb-location="srvOracleDS"
		connection-driver="oracle.jdbc.driver.OracleDriver"
		username="*****"
		password="*****"
		url="jdbc:oracle:thin:@192.168.**.**:1521:ORA92"
		inactivity-timeout="30"
	/>

Repository.xml

<jdbc-connection-descriptor jcd-alias="default"
default-connection="true"
                            platform="Oracle" jdbc-level="2.0"
				    jndi-datasource-name ="srvOracleDS"	
                            eager-release="false"
                            batch-mode="false" useAutoCommit="0"
                            ignoreAutoCommitExceptions="false">
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImp
l">

	<attribute attribute-name="autoNaming" attribute-value="false"/>

</sequence-manager>

</jdbc-connection-descriptor>

OJB.properties

########################################################################
####
...

PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBrok
erFactorySyncImpl
PersistenceBrokerClass=org.apache.ojb.broker.core.PersistenceBrokerImpl

...

maxActive=450
maxIdle=200
maxWait=2000
timeBetweenEvictionRunsMillis=60000
minEvictableIdleTimeMillis=60000
numTestsPerEvictionRun=200
whenExhaustedAction=0
validationQuery=select 1 from dual
testWhileIdle=true

...

ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFacto
ryManagedImpl
ConnectionManagerClass=org.apache.ojb.broker.accesslayer.ConnectionManag
erImpl

...
########################################################################
####

If you need more information, please send me an e-mail.

Thanks for your help.

Joan Miralles Ramis
Programador
Brújula Telecom
T. +34 971 433 909 - F. +34 971 433 910
www.brujulatelecom.com
__________________________________
En el corazón de su negocio


-----Mensaje original-----
De: Thomas Dudziak [mailto:tomdzk@gmail.com] 
Enviado el: miércoles, 02 de febrero de 2005 10:57
Para: OJB Users List
Asunto: Re: Connection pool duplication

What OJB version do you use ? How do you configure the connection ?
Could you post the relevant parts of repository_database.xml ?

Tom

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




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


Re: Connection pool duplication

Posted by Thomas Dudziak <to...@gmail.com>.
What OJB version do you use ? How do you configure the connection ?
Could you post the relevant parts of repository_database.xml ?

Tom

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