Topic
  • 9 replies
  • Latest Post - ‏2011-05-27T14:09:28Z by SystemAdmin
SystemAdmin
SystemAdmin
9224 Posts

Pinned topic Got "No current connection" when using embedded derby

‏2010-08-02T20:44:36Z |
NOTE: this thread was migrated from projectzero.org. Some content and formatting may have been lost in the move.


Originally posted by projectzero userid: wenjian - f=6&t=2169#p8876
We have a sMash app using embedded derby database. In FVT, when a single user is logged in, everything works fine. However, in SVT, when multiple users log in and concurrently update/read DB tables, we got the following exception. Does anyone know if there is any limitation for embedded Apache derby in zero? What may be the cause for "No current connection"? Thanks.

Caused by: com.ibm.pdq.runtime.exception.DataRuntimeException: pdq10148http://1.3.110 Unable to call next.;
Caused by: java.sql.SQLNonTransientConnectionException: No current connection.
at com.ibm.pdq.runtime.data.handlers.BaseResultIterator.hasNext(BaseResultIterator.java:76)
at com.ibm.pdq.runtime.internal.db.DataImpl.returnFirstRow(DataImpl.java:680)
at com.ibm.pdq.runtime.internal.db.DataImpl.queryFirst(DataImpl.java:363)
at zero.data.Manager.queryFirst(Manager.java:1378)
at com.ibm.commerce.soccom.testadapter.TestProfileAdapter.fetchProfileList(TestProfileAdapter.java:425)
at com.ibm.commerce.soccom.handler.html.AbstractHtmlHandler$ProfileManager.fetchProfiles(AbstractHtmlHandler.java:76)
at com.ibm.commerce.soccom.handler.html.BlogHtmlHandler.onRetrieve(BlogHtmlHandler.java:109)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at zero.core.interpreter.JavaInterpreter.invoke(JavaInterpreter.java:64)
... 30 more
Caused by: java.sql.SQLNonTransientConnectionException: No current connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.setupContextStack(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at com.ibm.pdq.runtime.internal.wrappers.PDQResultSetProxyHandler.invoke(PDQResultSetProxyHandler.java:56)
at $Proxy0.next(Unknown Source)
at com.ibm.pdq.runtime.data.handlers.BaseResultIterator.doNext(BaseResultIterator.java:165)
at com.ibm.pdq.runtime.data.handlers.BaseResultIterator.hasNext(BaseResultIterator.java:68)
at com.ibm.pdq.runtime.internal.db.DataImpl.returnFirstRow(DataImpl.java:687)
... 39 more
Caused by: java.sql.SQLException: No current connection.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
Updated on 2011-05-27T14:09:28Z at 2011-05-27T14:09:28Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-03T05:55:38Z  

    Originally posted by projectzero userid: qiuxiaox - f=6&t=2169#p8880
    Hello, welcome to project zero.

    To your question, did you start more than one JVM to access the database?
    According to Derby's document, Derby supports multiple connections to a given database, however, only one JVM may boot ("open") that database, so multiple applications running in different JVMs cannot access the same database.

    For more information, you can refer to below link.
    http://db.apache.org/derby/papers/Derby ... st_one_app

    I hope this answers your question to your satisfaction.
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-03T16:48:43Z  

    Originally posted by projectzero userid: wenjian - f=6&t=2169#p8881
    Thanks for your response. In our case, we only have one JVM accessing DB.
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-04T04:14:06Z  

    Originally posted by projectzero userid: zhangyp - f=6&t=2169#p8882
    Hi, Wenjian

    I found the problem discussed at 1t7158lt similar to your stack trace. The people in the mail list found the problem was likely caused by 1t7158lt of derby which has been fixed in derby 10.6.1.0. However, the derby in current repository is derby-10.3.3.1. Would you have a try on the latest derby and see whether the problem still exists?
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-04T15:53:03Z  

    Originally posted by projectzero userid: wenjian - f=6&t=2169#p8883
    Stephen,

    Thanks for your response. We are using the embedded derby that comes with zero 1.1.1.3 and will try derby 10.6.1.0.

    Thanks.
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-04T20:49:19Z  

    Originally posted by projectzero userid: ngawor - f=6&t=2169#p8884
    Within your app, edit ivy.xml and change the derby line to reflect the exact version you want:

    dependency name="derby" org="org.apache.derby" rev="10.6.1.0"

    then run:
    zero update

    and it should pull down the correct version of derby... the connection to maven to do the download is quite flaky - I had to try a couple times before I stopped getting timeouts and the jar downloaded successfully.

    Thanks,
    Nell
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-12T17:43:59Z  

    Originally posted by projectzero userid: wenjian - f=6&t=2169#p8914
    Our SVT team has tried derby-10.6.1.0. Unfortunately, the same problem (No current connection and Connection null) still exists. We tried both embedded derby and network derby, both of them have the problem.

    SVT has done some investigation and found the "No current connection" exception may be related to concurrent uses of derby database.

    • 1 user: the problem is rare, but it could come out during a 1 user/1 hour run.
    • 5 users (5 mins run): 2 occurrences of the "exception.
    • 10 users (5 mins run): 10 occurrences of the exception.
    • 20 users (5 mins run): 50+ occurrences of the exception.

    When looking at netstat, we find 42 CLOSE_WAIT connections at the end of test with network derby and 50 CLOSE_WAIT connections at the end of test with embedded derby. Do you think if these CLOSE_WAIT TCP connections have anything to do with "No current connection" exception?

    The zero trace files when running with network derby are attached below. If you want to see trace files with embedded derby, please let me know.

    1. attachment=0:tv0mpex6<!-- ia0 -->trace-0.0.log<!-- ia0 -->[/attachment:tv0mpex6]
    2. attachment=2:tv0mpex6<!-- ia2 -->trace-0.1.log<!-- ia2 -->[/attachment:tv0mpex6]
    3.attachment=1:tv0mpex6<!-- ia1 -->trace-0.2.log<!-- ia1 -->[/attachment:tv0mpex6]

    Thank you very much.
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-13T21:07:51Z  

    Originally posted by projectzero userid: ngawor - f=6&t=2169#p8921
    I have replied to Wenjian off the board in an attempt to gather some additional debug info.

    Thanks,
    Nell
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2010-08-16T18:09:58Z  

    Originally posted by projectzero userid: ngawor - f=6&t=2169#p8927
    This was resolved offline, but I want to post an update here in case anyone hits the same issue. The application code in question was sharing a static singleton instance of Manager. Since each manager manages its own database connection, this was causing database connections to be improperly shared and sometimes closed before an attempt was made to use a connection. Managers cannot be used in this way.

    Thanks,
    Nell
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: Got "No current connection" when using embedded derby

    ‏2011-05-27T14:09:28Z  

    Originally posted by projectzero userid: keerti - f=6&t=2169#p9391
    Hi...
    I am also getting the same error in my project during updation in the database derby,so will you please suggest the solution of it online....I am in extreme need of solution...I am also getting the error in my application
    java.sql.SQLNonTransientConnectionException: No current connection.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.setupContextStack(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)

    Thanks in advance....
    Keerti