Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipselink connection pooling

If connection pooling is not defined in the persistence.xml for eclipse link, what is the default behavior?

Will it open and close a JDBC connection for every transaction? Will it create a connection pool with some defaults?

like image 964
user1796571 Avatar asked Feb 27 '13 18:02

user1796571


3 Answers

The default connection pooling for EclipseLink when not using a data source is a pool of min/max 32 connections, with an initial of 1 connections. So each transaction will use a pooled connection, and not connect/disconnect.

like image 88
James Avatar answered Nov 04 '22 00:11

James


If you use an application server (Java EE) and container managed persistence, then you need to set up the connection pooling in the administration console of the application server, and don't need to set the pooling properties in the persistence.xml, e.g.:

<persistence-unit name="myPU" transaction-type="JTA">
  <jta-data-source>jdbc_my_DataSource</jta-data-source>
  <exclude-unlisted-classes>false</exclude-unlisted-classes>
  <shared-cache-mode>NONE</shared-cache-mode>
  <properties/>
</persistence-unit>

If you use EclipseLink without application server (Java SE), using application managed persistence, then if you don't configure pooling, Internal Connection Pooling will be used, e.g.:

<persistence-unit name="DemoPU" transaction-type="RESOURCE_LOCAL">
  <properties>
    <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
    <property name="javax.persistence.jdbc.user" value="myuser"/>
    <property name="javax.persistence.jdbc.password" value="mypassword"/>
    <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
  </properties>
</persistence-unit>
like image 43
Donato Szilagyi Avatar answered Nov 03 '22 23:11

Donato Szilagyi


<property name="eclipselink.connection-pool.default.initial" value="1"/>
<property name="eclipselink.connection-pool.default.min" value="64"/>
<property name="eclipselink.connection-pool.default.max" value="64"/>
like image 2
Armen Arzumanyan Avatar answered Nov 04 '22 00:11

Armen Arzumanyan