13 Replies Latest reply on Nov 23, 2006 12:21 PM by bocio

    Oracle 10g Fast Connection Failover

    ayampols

      Hi,

      Can anyone tell me if JBoss supports the Oracle 10g new Fast Connection Failover mechanism, and if so, what steps can I take to enable it?

      http://download-west.oracle.com/docs/cd/B13789_01/java.101/b10979/fastconnfail.htm#sthref492

      If JBoss doesn't support it, can someone point me to an appropriate resource where I can discover if the support is on an existing roadmap, and if not, how I could get involved in adding this functionality?

      Thank you in advance,
      Armen

        • 1. Re: Oracle 10g Fast Connection Failover

          That link requires me to remember by password for the Oracle site.

          JBoss supports any JDBC2 or JDBC3 compatible JDBC driver or XADataSource.
          Explain why this feature requires something beyond the spec by JBoss?

          • 2. Re: Oracle 10g Fast Connection Failover
            ayampols

            Adrian, I'm not clear on how to enable Fast Connection Failover with JBoss. To summarize Oracle's instructions, they basically say that, in addition to turning on a special process on the client host (ONS daemon, comes with Oracle client), one enables FCF

            by invoking setFastConnectionFailoverEnabled(true); on a DataSource instance before retrieving any connections from that instance.
            Here is their jdbc code example:
            // declare datasource
            ods.setUrl(
            "jdbc:oracle:oci:@(DESCRIPTION=
             (ADDRESS=(PROTOCOL=TCP)(HOST=cluster_alias)
             (PORT=1521))
             (CONNECT_DATA=(SERVICE_NAME=service_name)))");
            ods.setUser("scott");
            ods.setConnectionCachingEnabled(true);
            ods.setFastConnectionFailoverEnabled(true):
            ctx.bind("myDS",ods);
            ds=(OracleDataSource) ctx.lookup("MyDS");
            try {
             dx.getConnection(); // transparently creates and accesses cache
             catch (SQLException SE {
             }
             catch (ONSException ONS {
             // Work can continue here, but cache is not FCF enabled
             }
            
            The ods variable is just an OracleDataSource. I hope you see my puzzlement -- how can we do any of this using JBoss when JBoss takes care of instantiating and maintaining the datasource? Is there a section in our oracle-ds.xml file that we can modify? If not, is there any point in getting involved and adding this functionality? Would this be helpful to the community and the codebase? And if so, with whom do you suggest I speak about it?

            Thanks again,
            -Armen

            • 3. Re: Oracle 10g Fast Connection Failover

              I have added your question to the FAQ since you are the second person to ask
              this basic question this week:

              http://www.jboss.org/wiki/Wiki.jsp?page=I+want+to+plugin+a+custom%2Fthirdparty+DataSource

              • 4. Re: Oracle 10g Fast Connection Failover
                ayampols

                 

                "adrian@jboss.org" wrote:
                you are the second person to ask
                this basic question this week

                Perhaps it's not as basic as you would wish, as your link certainly does not address it. Let me rephrase, maybe my language was too obtuse: Oracle's JCA-compliant application server's J2EE container supports FCF. In their own words,

                In 10g if the back end database is RAC, Oracle Application Server subscribes to the
                RAC node failure/failover events that gets propagated to ONS (OracleAS
                Notification Service). ONS in turn propagates these failure events to JDBC layer in
                OracleAS 10g and the JDBC layer transparently cleans up the existing stale
                connection pool to the failed RAC node and creates another connection pool to
                live RAC node. This feature is called Fast Connection Failover. No other
                application server other than OracleAS 10g provides this functionality.


                I want to address this last sentence. I do not want Oracle to be the only AS to support it, I want to add this functionality to JBoss. And your post, if I understand it correctly, only points out the vacuous point that if one uses a third party driver that manages its own pool one is outside the J2EE environment managed by JBoss. I don't want to do this. I want to use JBoss's J2EE container, and extend it or plug in the functionality noted above. There are many who would be interested in this feature, and I'd like to help. If you care, please point me in the right direction. But please, no more links to incomplete and confusing (you say nothing about the XA datasource, as if it would support FCF or anything else out of the box) wiki pages.

                • 5. Re: Oracle 10g Fast Connection Failover

                  "No other
                  application server other than OracleAS 10g provides this functionality."

                  Of course no other application supports it.
                  It is propriatory rubbish.

                  There is a perfectly good notification in the spec to notify the application
                  server that the connection is broken.

                  javax.resource.spi.ConnectionEventListener.errorOccured(ConnectionEvent)
                  


                  This might work if the you are using the XADataSource, it depends whether
                  Oracle has deigned to supply the notification through this mechanism.

                  I repeat, if the application server is not managing the connections you are not using
                  JCA and cannot take advantage of the transaction/security integration with the
                  application server.

                  The only other mechanism I can think of making it work is to see whether
                  there is a propriatory api exposed and use a vendor specific plugin to map
                  this propriatory api to the spec defined mechanism.

                  • 6. Re: Oracle 10g Fast Connection Failover
                    ayampols

                     

                    "adrian@jboss.org" wrote:
                    "No other
                    application server other than OracleAS 10g provides this functionality."

                    Of course no other application supports it.
                    It is propriatory rubbish.


                    We will test it and confirm your findings. Not the proprietary bit (which hopefully you would not discard out of hand), but the rubbish part.


                    I repeat, if the application server is not managing the connections you are not using
                    JCA and cannot take advantage of the transaction/security integration with the
                    application server.


                    No need to repeat, that part is quite plain and it's why I tried to underscore my intention to stay within JCA. I mean, can I get any clearer about what I'm trying to do here? Leave the thread alone Adrian, you sound like a broken record and you just don't care.

                    Thanks anyway.

                    • 7. Re: Oracle 10g Fast Connection Failover

                       

                      "ayampols" wrote:

                      We will test it and confirm your findings. Not the proprietary bit (which hopefully you would not discard out of hand), but the rubbish part.


                      I meant it was rubbish because it was propriatory. If it was transparently propriatory
                      (i.e. a value add) I would be indifferent.

                      Leave the thread alone Adrian, you sound like a broken record and you just don't care.


                      It is a technique in teaching when you think somebody has missed the point
                      or doesn't understand. You keep repeating it in different words.
                      It has a technical name, but it is more commonly known as "Indoctrination". :-)
                      You are correct, I wouldn't make a good teacher - no patience!

                      • 8. Re: Oracle 10g Fast Connection Failover

                        Perhaps this would be fine if the following line from the sample code was removed:

                        ods.setConnectionCachingEnabled(true);

                        Maybe ayampols can create a test client to prove this true. From what I'm reading on this thread the fact that Oracle manages a pool is the main problem. The propriatary oracle notification might not be.

                        • 9. Re: Oracle 10g Fast Connection Failover
                          bocio

                          Any news on this topic?

                          I found no documentation about this feature and JCA compatibility.

                          NS in turn propagates these failure events to JDBC layer in
                          OracleAS 10g and the JDBC layer transparently cleans up the existing stale
                          connection pool to the failed RAC node and creates another connection pool to
                          live RAC node.


                          I made some test on plain JDBC without OracleAS...
                          Actually when the node fails, a specific exception is propagated to the jdbc driver and then the application.

                          Oracle states that, in this case a rollback shall not be issued because the driver has already rolled back the transaction.

                          I don't know if the

                          javax.resource.spi.ConnectionEventListener.errorOccured(ConnectionEvent)


                          is called inside the JCA.




                          • 10. Re: Oracle 10g Fast Connection Failover
                            weston.price

                            This, as well as TAF are Oracle specific features that are only applicable to using an Oracle specific connection pool and the OCI driver.

                            **This feature cannot be enabled using JBoss/JCA**

                            Note, there is nothing to prevent anyone from creating a seperate MBean that creates the DataSource and binds it into JNDI. However, use of this will be outside the scope of JCA and as such will not be subject to questions on this forum.

                            • 11. Re: Oracle 10g Fast Connection Failover
                              bocio

                               

                              "weston.price@jboss.com" wrote:
                              This, as well as TAF are Oracle specific features that are only applicable to using an Oracle specific connection pool and the OCI driver.
                              **This feature cannot be enabled using JBoss/JCA**


                              I agree,
                              We have many Oracle RAC installations. When we use a J2EE AS in front the database, TAF or FCF are disabled because you get some of these functionalities directly form the AS.
                              On a POJO application we always use thin driver, FCF and connection cache.
                              Anyway TAF is available only with OCI driver while FCF is available only on thin driver.

                              Regardin JCA and Vendor specific features. Well... :-) we are speaking of Oracle, not BingoBongoDB. Sometimes you are forced by thousand reasons to use it. JBoss JCA implementation gives you a handle:

                              getUnderlyingConnection()


                              What I find strange is that whenever someone ask about this method, an
                              excommunication is launched!
                              Terrible things could happen using it! You go blind...
                              So if you wrote this method, why you did not give us a way to notify the WrappedConnection that I want to close or destroy the underlying connection?

                              If you give an handle, give a complete one...

                              Bye



                              • 12. Re: Oracle 10g Fast Connection Failover
                                weston.price

                                I am not sure what you are saying.

                                As far as the TAF and other Oracle specfic features are concerned, the reason that they are not available in JBoss is because they do not *exist* in JBoss. They require an Oracle specfic datasource as well as Oracle to manage the underlying pool of JDBC connections. JBoss provides a DataSource implementation that wraps the underlying JDBC connection. This is not an Oracle DataSource. As a result, the Oracle specific features are simply not available.


                                What I find strange is that whenever someone ask about this method, an
                                excommunication is launched!
                                Terrible things could happen using it! You go blind...


                                I am sorry you have had this experience. What we generally try to impart to people is warning that if you are using an API in an unintended manner or purposely try to thrwart an API then you should not be surprised when unforseen consequences occur.


                                So if you wrote this method, why you did not give us a way to notify the WrappedConnection that I want to close or destroy the underlying connection?


                                Because frankly, this makes no sense. The point of using connection pooling is to increase scalability and reduce the cost of using expensive resources in a managed environment. The getUnderlyingConnection() method was added for those *rare* instances that a client would need to access features of the underlying JDBC driver not provided by the JDBC API.

                                Now, you could very well call close on the underlying connection, but that would fall squarely in the realm of *not recommended* abuses of an API. I am not sure why you would ever want to completely destroy the underlying connection anyway. Could you explain why you would want to do this?





                                • 13. Re: Oracle 10g Fast Connection Failover
                                  bocio

                                   

                                  "weston.price@jboss.com" wrote:

                                  I am sorry you have had this experience. What we generally try to impart to people is warning that if you are using an API in an unintended manner or purposely try to thrwart an API then you should not be surprised when unforseen consequences occur.


                                  As I said before, I completely agree with you, but in my experience, Sometime we are forced to integrate our AS with an existing legacy system and I have to stick with vendor specific data. If I have to call dozen of functions full of Oracle datatypes, should I kill the customer db architect with a JDBC book? :-)

                                  Furthermore, being Oracle a db market leader, sometimes tramples on standards...

                                  "weston.price@jboss.com" wrote:

                                  Now, you could very well call close on the underlying connection, but that would fall squarely in the realm of *not recommended* abuses of an API. I am not sure why you would ever want to completely destroy the underlying connection anyway. Could you explain why you would want to do this?


                                  I could need to work with a specific vendor type. I could do this with the underlying connection but... if something goes wrong I need a way to notify the ManagedConnection of the error.
                                  Would be very useful for solving particular problems in some cases and still write robust code.

                                  I've been working for years with Sybase and their datasource is nearly 100% jdbc compliant: you can also retrieve multiple resultset from store procs through jdbc.

                                  Bye