On Tue, Mar 10, 2009 at 12:15 PM, magellings <mark.gelli...@qg.com> wrote: > > Hello. > > Does anyone know if there is logic in activeMQ to retry connecting to a > database if JDBC master/slave is configured? Perhaps there is some > configuration I'm missing. Right now we log ship from the active Sql Server > database to the passive Sql Server database. During maintenance it would be > nice to fail to the passive database without impacting the ActiveMQ broker > and requiring a restart. When I tested I just stopped the sql server > windows service and the active ActiveMQ broker shut down requiring a manual > startup. > > Current JDBC master/slave configuration snippets: > > > <persistenceAdapter> > <jdbcPersistenceAdapter dataSource="#mssql-ds"/> > </persistenceAdapter> > > ... > > <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource" > destroy-method="close"> > <property name="driverClassName" > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> > <property name="url" > value="jdbc:sqlserver://QG076619.qg.com:1433;databaseName=activedb;user=sa;password=pa$$word"/> > <property name="username" value="activemq"/> > <property name="password" value="pa$$word"/> > </bean>
This is commonly the job of the connection pooler that you're using. A good connection pooler will test the connections when they're handed out from the pool to make sure that they're still in good shape. I know that c3p0 (http://c3p0.sf.net/) handles this via the c3p0.testConnectionOnCheckout attribute in its configuration. There are other connection poolers that handle this as well including the new Tomcat JDBC pooler (http://tomcat.apache.org/dev/dist/jdbc-pool/1.0-beta/v1.0.15-beta/) which is a rewrite of Commons DBCP (because DBCP is horribly unmaintained and broken). Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' Apache ActiveMQ - http://activemq.apache.org/ Apache Camel - http://camel.apache.org/ Apache ServiceMix - http://servicemix.apache.org/ Blog: http://bruceblog.org/