connection pooling


how do you handle connection pooling?  I don't understand how to open and close connection, or reconnect.

I've referenced the manual here, but where does this go:


The <connection> element

  <connection port="6136" max="100" />

The <connection> element specifies how clients can connect to the server:

    The port attribute specifies a TPC port on which the server is listening for new connections. Usually the default port 6136 should be specified. If another port is specified it also has to be specified by clients in the url connection string when connecting to the database (as explained in the JPA Overview section in chapter 3).
    The max attribute specifies the maximum number of simultaneous connections that are accepted by the server. A request for a connection that exceeds the maximum is blocked until another open connection is closed.


Every EntityManagerFactory instance manages a pool of connections and reuses them when it creates new EntityManager instances. See this manual page for more information on working with EntityManagerFactory (which manages the connection pool) and EntityManager (which represents a connection).

By default the maximum connection pool size is 50.

You can change it in the persistence.xml file, for example to maximum 100 connections:

    <property name="javax.jdo.option.MaxPool" value="100"/>
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

I'll read that section carefully, thank you.

The connection parameter:

<property name="javax.jdo.option.MaxPool" value="100"/>

is for any JPA, and not just proprietary ObjectDB products?  I didn't even realize that you had a specific product at first; most of your documentation seems to be about standard JPA.  Is that right?


This specific configuration is from JDO. ObjectDB supports both JPA and JDO (see the FAQ).

Since it is not part of JPA you cannot expect it to work as is with other JPA implementations.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login