Configuring Oracle XE connection pool in Glassfish and Using JPA

To setup an Oracle Datasource in Glassfish, follow these steps:

1. Download and copy the Oracle JDBC driver (ojdbc14.jar) to /glassfish/domains/domain1/lib/ext directory.

2. Start Glassfish.

3. Login to the admin interface and create a JDBC Connection Pool.
    Delete all properties, and add following properties:
    * user - set this to Oracle userid
    * password - set this to Oracle password
    * URL - set this to the URL, example jdbc:oracle:thin:@localhost:1521:xe.
    * xa-driver-does-not-support-non-tx-operations - set this to true.
Test the connection pool using ping.

4. Create a JDBC DataSource using the Connection Pool.


If in case of Oracle major version error : javax.persistence.PersistenceException: org.hibernate.HibernateException: unknown Oracle major version [11]

The fix for the error is add

<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

in your persistence.xml

Comments

Popular posts from this blog

Simple Invoice Creation With Jasper Report

Dynamic Image in Jasper Report

Auto Increment Oracle Table Id Mapping With JPA Entity