zootropo
zootropo

Reputation: 2491

Invalid Oracle URL specified with Sniffy

I'm trying to configure Sniffy to work with Oracle. I'm using Glassfish as application server, with JPA 2.0, and EclipseLink as provider.

When EclipseLink tries to allocate the connection, it fails saying that the Oracle URL specified is invalid, because of the "sniffer:" prefix, I guess:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed;
nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because:  Invalid Oracle URL specified
Error Code: 0

This is how I configured the pool in my domain.xml file:

<jdbc-resource pool-name="poolGI" object-type="system-all" jndi-name="jdbc/poolGI" />
<jdbc-connection-pool driver-classname="io.sniffy.MockDriver" name="poolGI" res-type="javax.sql.DataSource" datasource-classname="oracle.jdbc.pool.OracleDataSource">
    <property name="URL" value="sniffer:jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=service)))"></property>
    <property name="user" value="user"></property>
    <property name="password" value="password"></property>
</jdbc-connection-pool>

Upvotes: 1

Views: 433

Answers (1)

bedrin
bedrin

Reputation: 4586

Sniffy developer here.

Looks like oracle.jdbc.pool.OracleDataSource ignores the driver-classname property and implicitly uses oracle.jdbc.driver.OracleDriver. OracleDriver doesn't know about sniffer: schema, hence the exception.

You need to switch to another data source in order to use Sniffy. For example Hikari Connection Pool.

Upvotes: 0

Related Questions