Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Disabling EclipseLink Connection Pooling

You should be able to pass user/password/url/driver as properties to createEntityManager method without any additional customization required.

Eclipselink still requires "main" data source (or user/password/url/driver) to be connected at a start up - because you will never use it just create a "dummy" (but really existing in the db) user and list it in your persistence.xml

On 12/10/2010 7:22 AM, patric@xxxxxxxxxxx wrote:
I am having a similar problem with eclipselink 2.1.1.
I also want to disable the eclipselink connection pool because I want to
provide the correct Connection by Properties during EntityManager
creation. (exclusive isolated session mode)

My session customizer is always called (it's defined in the
persistence.xml), but unfortunately, this doesn't help, because the
connection pool configuration is set before the session customizer fires
(see EntityManagerSetupImpl.java:859 which will lead to
ServerSession.java:187).

All this end up that acquireClientConnection() (ServerSession.java:252)
will enter the "connection pool mode"-branch.

When I replace EclipseLink 2.1.1 jar with EclipseLink 1.1.2 jar and do
not change anything else, the other branch inside
acquireClientConnection() (disabled connection pool) is used.

So something changed from EclipseLink 1.1.x to 2.x - maybe by accident?

Best regards,
Patric

Zitat von Zarar Siddiqi <zarars@xxxxxxxxx>:

Looked into this more, and as Andrei suggested, the customizer is
randomly
being called (or not called). It's quite weird. Is there another way to
specify a session customizer? Looked through the docs and couldn't find
much.




On Wed, Dec 8, 2010 at 10:55 AM, Andrei Ilitchev
<andrei.ilitchev@xxxxxxxxxx
wrote:

I you sure that your customizer is called?


On 12/8/2010 10:07 AM, Zarar Siddiqi wrote:

Thanks for the reply, but that didn't do it.

I downloaded the source and debugged it to the point where I see the
following call on line 104 in DatabaseLogin.java:

this.useDefaultDriverConnect();

That's the which is calling this method:

public void useDefaultDriverConnect() {
setConnector(new DefaultConnector());
}


which is causing the DefaultConnector to be set.

I tried searching for a dontUseDefaultDriverConnect() method but can't
find it.

Still stuck. Will look into it more but if something jumps out, do let
me know.

Thanks,





On Tue, Dec 7, 2010 at 10:06 PM, Michael O'Brien
<michael.obrien@xxxxxxxxxx <mailto:michael.obrien@xxxxxxxxxx>> wrote:

Zarar,
May help - try setting the new connector on both the read and
write connection pool, as it looks like the failure is due to
DefaultConnector deferring to using RESOURCE_LOCAL jdbc properties
for a direct connection.

JNDIConnector readConnector =

(JNDIConnector)((DatabaseLogin)((ServerSession)session).getReadConnectionPool().getLogin()).getConnector();


or


(JNDIConnector)((DatabaseLogin)((ServerSession)session).getReadConnectionPool().getLogin()).setConnector(new

JNDIConnector(dataSource));

thank you
/Michael


On 2010-12-07 17:33, Zarar Siddiqi wrote:

Using 2.1.1. Trying to completely disable connection pooling by
EclipseLink as it's handled externally, but I randomly get the
following exception where it tries to get a connection on its own
but fails.

Exception Description: Unable to acquire a connection from driver
[null], user [null] and URL [null]. Verify that you have set the
expected driver class and URL. Check your login, persistence.xml
or sessions.xml resource. The jdbc.driver property should be set
to a class that is compatible with your database platform
at

org.eclipse.persistence.exceptions.DatabaseException.unableToAcquireConnectionFromDriverException(DatabaseException.java:376)

at

org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:91)



In my session customizer I have:

session.getLogin().setConnector(new
JNDIConnector(dataSource)); // I get dataSource from Spring
session.getLogin().useExternalConnectionPooling();

My persistence.xml looks like:

<persistence xmlns="http://java.sun.com/xml/ns/persistence";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
version="2.0">
<persistence-unit name="db">
<properties>
<property name="eclipselink.target-database"
value="ca.utoronto.sis.sws.db.ExtendedDB2MainframePlatform"/>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.logger" value="SLF4JSessionLog"/>
<property name="eclipselink.session.customizer"
value="EclipseLinkSessionCustomizer"/>
</properties>
</persistence-unit>
</persistence>


Any idea why it's trying to go and do this on its own when I tell
it not to?

Thanks,


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>

https://dev.eclipse.org/mailman/listinfo/eclipselink-users



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>

https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
Zarar Siddiqi
416-737-9024



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
Zarar Siddiqi
416-737-9024





_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top