2 Replies Latest reply on Jul 25, 2007 12:02 PM by peterj

    Problems with database connection

    chitão

      Hey there, I'm new in the forum and I have a issue that is killing me.

      Well, it goes like this.
      I have a JBoss running, and a Oracle instance as well.
      Sometimes, the Oracle goes down while the JBoss is still up.
      While that happens, JBoss still do some pooling to see how the connection with the DB is, but it get no answer, of course.
      When the DB comes up again, JBoss dispatches some errors, which I can't find them in my logs right now. So I have to halt it, and then run it again, so things can work as they should.

      What I need is something that tries to check the connection with the DB, from time to time, and if the DB aint available, it closes the current queries, and just stay pooling to check the connection, until the DB comes back again.

      Anyway, I found a xml tag in oracle-ds.xml that looked like it would help me, but I'm not sure that it did. The tag was: <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>

      Sorry about all the text, but my english is not very good and I wanted to try to make myself as clear as possible.

      Thankyou for your help.

      Chitão

        • 1. Re: Problems with database connection
          elvis00

          Hi,

          I have exactly the same problem.

          What is JBoss doing when I uncomment the <valid-connection-checker-class-name>?

          I think JBoss is checking the connection before handing the connection to the application with the sql I configure also.

          If the SQL isn't succeddful I expect a exeption in server.log, right?

          Cheers
          Markus

          • 2. Re: Problems with database connection
            peterj

            For Oracle, it is using the pingDatabase method to check if the database is available. You could see either a warning or a SQL exception in the log file if the ping fails. Look at the following files in the source:

            connector/src/main/org/jboss/resource/adapter/jdbc/vendor/OracleValidConnectionChecker.java
            connector/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java (the checkValid method)