Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Exception Description: DatabaseAccessor not connected.
Exception Description: DatabaseAccessor not connected. [message #759590] Tue, 29 November 2011 09:51 Go to next message
Ronny  is currently offline Ronny Friend
Messages: 7
Registered: October 2011
Junior Member
I have the sequence of using entitymanager as below

1) em.getTransactin().begin()
2) Query q = em.createNamedQuery, which will call a stored procedure and the stored procedure will return cursor.
3) CursoredStream c = (CursoredStream) q.getSingleResult();
4) Loop thru the CursoredStream
5) Close the CursoredStream

After 33 times execution of the above loop failed, encountered the exception "Exception Description: DatabaseAccessor not connected".
Recap the 32st (success) & the 33rd (fail) log below.

Seems that EclipseLink have 32 connections in connection pool by default.
When execute a query which return a cursoredStream, it will close the connection.
When all connections in the pool is disconnected, the 33rd run will be failed due to DatabaseAccessor not connected.


[EL Finer]: 2011-11-29 17:34:45.114--ServerSession(1208495415)--client acquired: 72420802
[EL Finer]: 2011-11-29 17:34:45.115--ClientSession(72420802)--acquire unit of work: 1700675012
[EL Finer]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:45.116--UnitOfWork(1700675012)--Execute query DataModifyQuery()
[EL Finest]: 2011-11-29 17:34:45.117--ServerSession(1208495415)--Connection(418787413)--Connection acquired from connection pool [default].
[EL Finer]: 2011-11-29 17:34:45.117--ClientSession(72420802)--Connection(418787413)--begin transaction
[EL Fine]: 2011-11-29 17:34:45.117--ClientSession(72420802)--Connection(418787413)--CALL db_set_r_sett_tx()
[EL Finer]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:45.12--UnitOfWork(1700675012)--Execute query ReadAllQuery(name="db_sett_eh_open_cr_cur" referenceClass=SysEventTT )
[EL Fine]: 2011-11-29 17:34:45.121--ClientSession(72420802)--Connection(418787413)--CALL db_sett_eh_open_cr_cur()
[EL Finest]: 2011-11-29 17:34:45.124--ServerSession(1208495415)--Connection(418787413)--Connection released to connection pool [default].
[EL Finer]: 2011-11-29 17:34:45.127--UnitOfWork(1700675012)--release unit of work
[EL Finer]: 2011-11-29 17:34:45.127--ClientSession(72420802)--Connection(418787413)--rollback transaction
[EL Finest]: 2011-11-29 17:34:45.127--ServerSession(1208495415)--Connection(418787413)--Connection released to connection pool [default].
[EL Config]: 2011-11-29 17:34:45.127--ServerSession(1208495415)--Connection(418787413)--disconnect
[EL Finer]: 2011-11-29 17:34:45.128--ClientSession(72420802)--client released



[EL Finer]: 2011-11-29 17:34:46.133--ServerSession(1208495415)--client acquired: 237585114
[EL Finer]: 2011-11-29 17:34:46.133--ClientSession(237585114)--acquire unit of work: 920911225
[EL Finer]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--begin unit of work flush
[EL Finer]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--end unit of work flush
[EL Finest]: 2011-11-29 17:34:46.135--UnitOfWork(920911225)--Execute query DataModifyQuery()
[EL Finest]: 2011-11-29 17:34:46.136--ServerSession(1208495415)--Connection(127616840)--Connection acquired from connection pool [default].
[EL Finer]: 2011-11-29 17:34:46.136--ClientSession(237585114)--Connection(127616840)--begin transaction
[EL Warning]: 2011-11-29 17:34:46.14--ClientSession(237585114)--Local Exception Stack:
Exception [EclipseLink-4005] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: DatabaseAccessor not connected.

Re: Exception Description: DatabaseAccessor not connected. [message #759606 is a reply to message #759590] Tue, 29 November 2011 10:35 Go to previous messageGo to next message
Ronny  is currently offline Ronny Friend
Messages: 7
Registered: October 2011
Junior Member
I just changed max connection to 1, I got the error immediately. How do I use CursoredStream but avoid EclipseLink close the connection?

Thanks in advance


[EL Finer]: 2011-11-29 18:08:47.961--UnitOfWork(1039701893)--begin unit of work flush
[EL Finer]: 2011-11-29 18:08:47.961--UnitOfWork(1039701893)--end unit of work flush
[EL Finest]: 2011-11-29 18:08:47.962--UnitOfWork(1039701893)--Execute query ReadAllQuery(name="db_sett_open_dangling_cur" referenceClass=SysEventTT )
[EL Fine]: 2011-11-29 18:08:47.963--ClientSession(570824606)--Connection(17649447)--CALL db_sett_open_dangling_cur(?)
bind => [1 parameter bound]
[EL Finest]: 2011-11-29 18:08:47.981--ServerSession(1208495415)--Connection(17649447)--Connection released to connection pool [read].
[EL Config]: 2011-11-29 18:08:47.981--ServerSession(1208495415)--Connection(17649447)--disconnect
[EL Finest]: 2011-11-29 18:08:47.989--ServerSession(1208495415)--Connection(17649447)--Connection released to connection pool [read].
[EL Config]: 2011-11-29 18:08:47.989--ServerSession(1208495415)--Connection(17649447)--disconnect
[EL Warning]: 2011-11-29 18:08:47.989--UnitOfWork(1039701893)--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.ibm.db2.jcc.a.SqlException: [jcc][t4][10251][10308][4.3.111] java.sql.Connection.close() requested while a transaction is in progress on the connection.
The transaction remains active, and the connection cannot be closed. ERRORCODE=-4471, SQLSTATE=null
Error Code: -4471
Query: ReadAllQuery(name="db_sett_open_dangling_cur" referenceClass=SysEventTT )
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:475)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.disconnect(DatasourceAccessor.java:481)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.disconnect(DatabaseAccessor.java:485)
at org.eclipse.persistence.sessions.server.ConnectionPool.releaseConnection(ConnectionPool.java:344)
at org.eclipse.persistence.sessions.server.ServerSession.releaseReadConnection(ServerSession.java:831)
at org.eclipse.persistence.sessions.server.ClientSession.releaseReadConnection(ClientSession.java:782)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.releaseReadConnection(UnitOfWorkImpl.java:5634)
at org.eclipse.persistence.queries.Cursor.close(Cursor.java:124)
at org.eclipse.persistence.queries.CursoredStream.retrieveNextObject(CursoredStream.java:410)
at org.eclipse.persistence.queries.CursoredStream.setLimits(CursoredStream.java:462)
at org.eclipse.persistence.queries.CursoredStream.<init>(CursoredStream.java:58)
at org.eclipse.persistence.queries.CursoredStreamPolicy.execute(CursoredStreamPolicy.java:67)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:406)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1097)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:829)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1056)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:390)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1144)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2863)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1501)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1483)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1457)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:773)

[Updated on: Tue, 29 November 2011 10:36]

Report message to a moderator

Re: Exception Description: DatabaseAccessor not connected. [message #759607 is a reply to message #759590] Tue, 29 November 2011 10:35 Go to previous messageGo to next message
Ronny is currently offline RonnyFriend
Messages: 10
Registered: July 2009
Junior Member
I just changed max connection to 1, I got the error immediately. How do I use CursoredStream but not avoid EclipseLink close the connection?

Thanks in advance


[EL Finer]: 2011-11-29 18:08:47.961--UnitOfWork(1039701893)--begin unit of work flush
[EL Finer]: 2011-11-29 18:08:47.961--UnitOfWork(1039701893)--end unit of work flush
[EL Finest]: 2011-11-29 18:08:47.962--UnitOfWork(1039701893)--Execute query ReadAllQuery(name="db_sett_open_dangling_cur" referenceClass=SysEventTT )
[EL Fine]: 2011-11-29 18:08:47.963--ClientSession(570824606)--Connection(17649447)--CALL db_sett_open_dangling_cur(?)
bind => [1 parameter bound]
[EL Finest]: 2011-11-29 18:08:47.981--ServerSession(1208495415)--Connection(17649447)--Connection released to connection pool [read].
[EL Config]: 2011-11-29 18:08:47.981--ServerSession(1208495415)--Connection(17649447)--disconnect
[EL Finest]: 2011-11-29 18:08:47.989--ServerSession(1208495415)--Connection(17649447)--Connection released to connection pool [read].
[EL Config]: 2011-11-29 18:08:47.989--ServerSession(1208495415)--Connection(17649447)--disconnect
[EL Warning]: 2011-11-29 18:08:47.989--UnitOfWork(1039701893)--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.ibm.db2.jcc.a.SqlException: [jcc][t4][10251][10308][4.3.111] java.sql.Connection.close() requested while a transaction is in progress on the connection.
The transaction remains active, and the connection cannot be closed. ERRORCODE=-4471, SQLSTATE=null
Error Code: -4471
Query: ReadAllQuery(name="db_sett_open_dangling_cur" referenceClass=SysEventTT )
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:475)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.disconnect(DatasourceAccessor.java:481)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.disconnect(DatabaseAccessor.java:485)
at org.eclipse.persistence.sessions.server.ConnectionPool.releaseConnection(ConnectionPool.java:344)
at org.eclipse.persistence.sessions.server.ServerSession.releaseReadConnection(ServerSession.java:831)
at org.eclipse.persistence.sessions.server.ClientSession.releaseReadConnection(ClientSession.java:782)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.releaseReadConnection(UnitOfWorkImpl.java:5634)
at org.eclipse.persistence.queries.Cursor.close(Cursor.java:124)
at org.eclipse.persistence.queries.CursoredStream.retrieveNextObject(CursoredStream.java:410)
at org.eclipse.persistence.queries.CursoredStream.setLimits(CursoredStream.java:462)
at org.eclipse.persistence.queries.CursoredStream.<init>(CursoredStream.java:58)
at org.eclipse.persistence.queries.CursoredStreamPolicy.execute(CursoredStreamPolicy.java:67)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:406)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1097)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:829)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1056)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:390)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1144)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2863)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1501)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1483)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1457)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:773)
Re: Exception Description: DatabaseAccessor not connected. [message #760300 is a reply to message #759590] Thu, 01 December 2011 19:48 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

The exception posted shows that EclipseLink is trying to release the connection back to the connection pool when the cursor is done - after the last row has been obtained or an exception has occurred. It should have nothing to do with the number of connections in the pool, since it will reuse the same connection until the cursor is closed. The connection needs to remain open as long as the cursor does. So this error should occur depending on the page/read size of the cursor and the amount of data within the cursor or if there is another exception occuring - such as if EclipseLink is trying to obtain a connection.

Are you using JTA? If so, you should not be using em.getTransaction.begin() to demarcate the transaction, so it could be there is a configuration problem.

Things to check:
1) That you have configured your persistence unit connection pool and transaction-type correctly. You didn't mention the server you are on, but there are examples for various servers at:
http://wiki.eclipse.org/EclipseLink/Examples/JPA

2) that you are checking for the end of the CursoredStream as described here:
http://wiki.eclipse.org/Using_Advanced_Query_API_(ELUG)#How_to_Handle_Java_Streams

3) That this reproduces with the latest EclipseLink nightly build or release (2.3.1). There was a scrollablecursor bug fixed that seems similar, but it will make it easier to diagnose if this turns out to be a bug. You could also try to use a scrollableCursor instead to see if it works around your issue.

Best Regards,
Chris
Re: Exception Description: DatabaseAccessor not connected. [message #760303 is a reply to message #759590] Thu, 01 December 2011 19:48 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

The exception posted shows that EclipseLink is trying to release the connection back to the connection pool when the cursor is done - after the last row has been obtained or an exception has occurred. It should have nothing to do with the number of connections in the pool, since it will reuse the same connection until the cursor is closed. The connection needs to remain open as long as the cursor does. So this error should occur depending on the page/read size of the cursor and the amount of data within the cursor or if there is another exception occuring - such as if EclipseLink is trying to obtain a connection.

Are you using JTA? If so, you should not be using em.getTransaction.begin() to demarcate the transaction, so it could be there is a configuration problem.

Things to check:
1) That you have configured your persistence unit connection pool and transaction-type correctly. You didn't mention the server you are on, but there are examples for various servers at:
http://wiki.eclipse.org/EclipseLink/Examples/JPA

2) that you are checking for the end of the CursoredStream as described here:
http://wiki.eclipse.org/Using_Advanced_Query_API_(ELUG)#How_to_Handle_Java_Streams

3) That this reproduces with the latest EclipseLink nightly build or release (2.3.1). There was a scrollablecursor bug fixed that seems similar, but it will make it easier to diagnose if this turns out to be a bug. You could also try to use a scrollableCursor instead to see if it works around your issue.

Best Regards,
Chris
Previous Topic:Server startup FileNotFoundException
Next Topic:TableGenerator and Default-Value pkColumnValue
Goto Forum:
  


Current Time: Sat Apr 20 05:41:51 GMT 2024

Powered by FUDForum. Page generated in 0.03394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top