-
1. Re: Listening Database Failover
vickyk Jun 7, 2007 8:33 AM (in response to kanth_seenu)I want to do some specifc operations whenever a database failover occurs.
Database failover are considered as the FATAL exception by the JCA framework . JBoss JCA can close the Connection if the FATAL exception is detected during the usage of the Connection , to avail the feature which would detect the fatal errors and close the connection you would need to configure the ExceptionSorter in your application .
Refer to this link to know how to configure ExceptionSorter
http://wiki.jboss.org/wiki/Wiki.jsp?page=SQLExceptionIONetwork
So you can override the ExceptionSorter and perform the operations which you need to do when the DB failover occurs . -
2. Re: Listening Database Failover
kanth_seenu Jun 7, 2007 10:28 AM (in response to kanth_seenu)Thanks for the reply vicky.
Had this in the queue, but what is the assurance that switchover will occur when the exceptions happens. Listening to the place which takes care of the actual switchover must be more meaningful than this. Am I right? -
3. Re: Listening Database Failover
kanth_seenu Jun 14, 2007 1:18 AM (in response to kanth_seenu)Still searching............. for an option to do it
-
4. Re: Listening Database Failover
adrian.brock Jun 18, 2007 10:29 AM (in response to kanth_seenu)Interesting, there is a configuration property that lets you decide how the
URL is selected, i.e. how it fails over. But it is not properly configured or documented.
http://jira.jboss.com/jira/browse/JBAS-4490
Absent this configuration it uses the default
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory$URLSelector
which does NOT the hook you are looking for.
I guess you could override this strategy
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/trunk/connector/src/main/org/jboss/resource/adapter/jdbc/URLSelectorStrategy.java?view=markup
to emit some form of notification when a new url is chosen.
But where you would emit that notification to is a different question?
ManagedConnectionFactorys are just "stateless" javabeans.
They don't have references into the JMX system or any other part of JBoss. -
5. Re: Listening Database Failover
vickyk Jun 20, 2007 5:41 AM (in response to kanth_seenu)Adrian ,
Yes I made these changes for the
http://jira.jboss.com/jira/browse/JBAS-3707
I have plans to make wiki on this and also this would now result in lot of changes in the Jboss Admin docs as ha related rar's would go off now .
Let me take http://jira.jboss.com/jira/browse/JBAS-4490 if you have not started any work on it. -
6. Re: Listening Database Failover
krithi Aug 24, 2007 8:26 AM (in response to kanth_seenu)We are using jboss-4.0.5.GA.
We are unable to locate org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory class in any of the jars. We searched jboss-common-jdbc-wrapper.jar. Even local package is not there. Please let us know in which jar we would find LocalManagedConnectionFactory class -
7. Re: Listening Database Failover
krithi Aug 24, 2007 9:42 AM (in response to kanth_seenu)Am I searching in the correct jars or are we missing any point here.
Thanks
Krithi -
8. Re: Listening Database Failover
adrian.brock Aug 24, 2007 10:27 AM (in response to kanth_seenu)STOP HIJACKING SOMEBODY ELSE'S THREAD.
YOUR QUESTION IS NOT EVEN RELEVANT TO THE ORIGINAL TOPIC
AND IS CERTAINLY NOT HELPING THE ORIGINAL POSTER.
AND TRY USING SEARCH WHERE YOUR QUESTION IS ALREADY ASKED AND
ANSWERED. -
9. Re: Listening Database Failover
kanth_seenu Aug 27, 2007 3:04 AM (in response to kanth_seenu)"adrian@jboss.org" wrote:
Interesting, there is a configuration property that lets you decide how the
URL is selected, i.e. how it fails over. But it is not properly configured or documented.
http://jira.jboss.com/jira/browse/JBAS-4490
Adrian/Vicky,
Sorry to take your time again on this. Can you please let us know on how to override the URL selection startegy. Hope there is no way by which I can specify my own class as a strategy to be set (I mean in ra.xml).
I am struck here, expecting your help on this -
10. Re: Listening Database Failover
vickyk Aug 27, 2007 5:23 AM (in response to kanth_seenu)At the rar level it can be done by adding the config-property-value
<config-property> <description>The configurable URLSelectorStrategy class name.</description> <config-property-name>UrlSelectorStrategyClassName</config-property-name> <config-property-type>java.lang.String</config-property-type> <config-property-value>your URL selector strategy ......</config-property-value> </config-property>
http://anonsvn.jboss.org/repos/jbossas/trunk/connector/src/resources/local-rar/META-INF/ra.xml
You don't need to play at the RAR level .
All you need is to have the following configuration at the ManagedConnectionFactory setting<url-selector-strategy-class-name>org.demo.SampleUrlSelector</url-selector-strategy-class-name>
This is the entry you need to place in the -ds.xml file .
Right now I am not able to find the samples where I had tried it , I will give it a test this weekend and probabily update the wiki .
Also make sure that your custom code is made available to the server . You can jar it and drop it in the $JBOSS_HOME/server/default/lib directory . -
11. Re: Listening Database Failover
kanth_seenu Aug 27, 2007 10:18 AM (in response to kanth_seenu)As suggested by you I went with approach 2 and added my class in default-ds file
But the switchover happened without giving control to my class. Am I missing anything?
Even with a junk value like the one below the switchover happened without issues.....
<url-selector-strategy-class-name>abcd</url-selector-strategy-class-name>
To remind again, I am using 4.0.5 GA version of Jboss. -
12. Re: Listening Database Failover
vickyk Aug 27, 2007 2:28 PM (in response to kanth_seenu)It is done in Jboss 5