2 Replies Latest reply on Apr 25, 2003 6:35 PM by samart

    Database reconnect (JB 3.2)

    sys user Master

      We are using jboss 3.2 to connect to sybase database. I want to know the following (I browsed through the posts, but could not find definite answers):

      1. If database server goes down and comes back up, is there a way to auto-refresh the connections in the pool without having to use the jmx-console.

      2. In one of the replies, David mentioned using TestValidConnectionSQL to check if the connections are valid. Is this a parameter that can be specified in *-ds.xml? If so, do I need to write an exception listener that would be notified if the check is unsuccessful, or will the connection be refreshed by Connection pool mbean?

      3. Can InvalidateOnError flag be used in *-ds.xml?

      Database reconnect is probably a very important issue in any large application supporting failover etc, so I am expecting to find some built in supoort for this. Please let me know if you came across these problems and how did you resolve them.


        • 1. Re: Database reconnect (JB 3.2)
          David Jencks Master

          1. I'm not sure what you mean by auto-refresh. If you can get the db server to send remote jmx notifications that it is crashing and that it is available again you might be able to write something. Meanwhile all I know how to do is to remove connections that indicate they are dead by throwing exceptions when you try to use them.

          2. <!--example: this is executed each time before a connection is handed out from the pool-->
          <check-valid-connection-sql>select * from dual where 1 = 2</check-valid-connection-sql>

          3. no. you can write and use an ExceptionSorter that will tell jboss if an exception means the connection is dead. Look at the Oracle configs for an example. If you contribute one for Sybase I will enthusiastically commit it.

          The best solution I know of is for the database to provide a jca adapter that properly implements the jca specified error notification to the app server. Anything else is a workaround. Both the checkValidConnectionSQL and the exceptionsorter are attempts to bolt such functionality onto drivers that lack it.

          • 2. Re: Database reconnect (JB 3.2)
            samart Newbie

            unplugging my network cable from my laptop running jboss and testing this out, jboss does not seem to not have problems re-initialzing the connections.

            also, i thought i had read in this forum that the connections are recycled periodically.