Thank you for link. I think it will help.
I suppose that problem is in JDBC driver or maybe its my misuse of JPA.
This is sample code that make my decision to access DB only through 1 connection.
Call persist and select.
EntityManagerFactory emf = ...;
EntityManager em1;
EntityManager em2;
em1 = emf.createEntityManager();
em1.persist(<entity>);
em1.flush();
em1.clear();
em1.close();
em2 = emf.createEntityManager();
List<Entity> list = em2.createQuery("select object(o) from Entity as o");
em2.close();
According to EclipseLink log:
Everything is OK when em1 and em2 uses same connection. list contains <entity> as supposed.
When em2 uses different connection from em1 list don't contain persisted <entity>.
I think that bug is in JDBC driver.
*) It doesn't allow change transaction isolation level.
*) maybe it will work when em1 connection is closed and then opened another connection in em2
----- Original Message -----
From: "Rohit Banga" <
rohit.banga@xxxxxxxxxx>
To: "rohit banga" <
rohit.banga@xxxxxxxxxx>, "EclipseLink User Discussions" <
eclipselink-users@xxxxxxxxxxx>
Sent: Tuesday, April 12, 2011 10:24:43 AM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: Re: [eclipselink-users] Connection pool with 1 shared connection for all reading a writing
But on second thoughts, since your driver can provide just one
connection how can you possibly share it among different threads?
You need a way to sequence your messages to the DBMS.
On 4/12/2011 1:49 PM, Rohit Banga wrote:
Hi Martin
You can consider using a third-party connection pool like
Universal Connection Pool (UCP).
The following link should be useful:
http://onpersistence.blogspot.com/2008/04/eclipselink-and-datasources.html
Let me know if the above works for you. You may need to tweak the
code a bit.
On 4/12/2011 1:34 PM, Janda Martin wrote:
Please can you help me.
Due to bugs in prehistoric third party JDBC driver we are forced to access database through only one shared connection for reading and writing.
Environment:
Java SE 6u24, Eclipselink 2.1.2, platform MS Access
I tried to limit connection pool that solved the problem with shared connection for reading/writing
<property name="eclipselink.jdbc.connections.initial" value="0"/>
<property name="eclipselink.jdbc.connections.min" value="0"/>
<property name="eclipselink.jdbc.connections.max" value="1"/>
<property name="eclipselink.jdbc.connection_pool.read.shared" value="true"/>
<property name="eclipselink.jdbc.read-connections.shared" value="true"/>
There is problem when I want access DB from multiple threads. Because other waits on Connection Pool for releasing connection.
Typical scenario:
1st thread - works ScrollableCursor
2nd thread - try to execute ReadAllQuery (select * from...)
ReadAllQuery is waiting for connection that is held by ScrollableCursor
I think that is possible to implement custom connection pool.
Question: is there any documentation/tutorial or code sample that shows how to implement connection pool for EclipseLink 2.1.2. Would it work for EclipseLink 2.2, newer versions?
Thank you very much for help
Martin
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users