2

I am currently trying different connection pools together with eclipselink. The one I am currently configuring is the one by eclipselink itself. Now I am not sure if it is meant to be used in production or if I should use another such as HikariCP? Also I am not sure how to detect if the Eclipselink connection pool is really running. My configuration is the following:

persistence.xml

...
      <!-- Configuring Eclipse Link -->
      <property name="javax.persistence.jdbc.driver"          value="net.sourceforge.jtds.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.url"             value="jdbc:jtds:sqlserver://SERVER/dev;instance=MSSQL2008R2"/>
      <property name="javax.persistence.jdbc.user"          value="user"/>
      <property name="javax.persistence.jdbc.password"      value="password"/>
      <property name="eclipselink.persistence-context.flush-mode" value="commit" /> <!-- Flushing occurs at transaction commit. (https://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_persistence_context_flushmode.htm)-->

      <!-- We use the EclipseLink internal components (https://www.eclipse.org/eclipselink/documentation/2.6/jpa/extensions/persistenceproperties_ref.htm)-->
      <!-- Eclipselink jdbc configuration -->
      <property name="eclipselink.jdbc.batch-writing" value="JDBC"/> <!-- Batch-writing is supported by mssql and our jdbc driver (https://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_jdbc_batchwriting.htm) -->
 <!-- <property name="eclipselink.jdbc.batch-writing.size" value="10000"/>  --> <!--Performance testing http://java-persistence-performance.blogspot.ch/2013/05/batch-writing-and-dynamic-vs.html -->
      <property name="eclipselink.jdbc.bind-parameters" value="true"/> <!-- Parameterized sql queries -->
      <property name="eclipselink.jdbc.cache-statements" value="true"/> <!-- https://docs.oracle.com/middleware/1212/core/ASPER/toplink.htm#ASPER99838 -->
      <property name="eclipselink.jdbc.cache-statements.size" value="10000"/>
      <property name="eclipselink.jdbc.allow-native-sql-queries" value="false"/> <!-- We explicitly set this, even though it is disabled by multitenancy by default -->

      <!-- Eclipselink connection pool configuration-->
      <property name="eclipselink.connection-pool.default.initial" value="50" />
      <property name="eclipselink.connection-pool.default.min" value="50"/>
      <property name="eclipselink.connection-pool.default.max" value="100"/>
      <property name="eclipselink.connection-pool.default.url" value="jdbc:jtds:sqlserver://SERVER/dev;instance=MSSQL2008R2"/>

      <!-- Eclipselink cache configuration -->
      <property name="eclipselink.cache.shared.default" value="true" />

      <!-- Eclipselink logging configuration -->
      <property name="eclipselink.logging.level" value="OFF"/> <!-- How much log should be shown | from: https://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging#Log_Level_Configuration-->
      <property name="eclipselink.logging.level.sql" value="OFF"/> <!-- How to show the sql queries -->

      <property name="eclipselink.target-database" value="SQLServer"/> <!-- What sql database is used | from: http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_target_database.htm-->
      <property name="eclipselink.ddl-generation" value="none"/>
      <property name="eclipselink.session.customizer" value="platform.data.EclipseLinkSessionCustomizer"/> <!-- Defines a naming strategy  -->
      <property name="eclipselink.multitenant.tenants-share-emf" value="false"/>
 ...

Thank you for your help!

Ben
  • 2,314
  • 1
  • 19
  • 36
  • 1
    EclipseLink's internal connection pool was used by customers since TopLink was first released. If you find a setting you need that the EclipseLink internal pooling doesn't have, switch. – Chris Jan 18 '17 at 14:43
  • 1
    Sounds great! Can I somehow query if it is running? Or is it always running if it is not using any other pool? I just want to be sure that my configurations work and I am not running on a single connection. – Ben Jan 19 '17 at 09:40
  • Also is there a reason you always answer in comments? I would have given you full credit for your answers about 5 times now. – Ben Jan 20 '17 at 09:50
  • Thanks. My comments are lazy attempts at pointing toward an actual answer. EclipseLink logging can show the connections it creates, and has some profiling (https://www.eclipse.org/eclipselink/documentation/2.5/solutions/performance002.htm) and monitoring tools, but I'm not sure that is what you want. The best way might be to check the database itself, and check for open sessions – Chris Jan 20 '17 at 15:21

0 Answers0