You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Michalis <mi...@gmail.com> on 2013/05/10 15:47:10 UTC

SqlServer Master/Slave

Hi all,

I use activemq as it is embeded in SMX 4.5.0
I'm trying to use the jdbc message storage with Microsoft SQL Server as I
want to achieve master/slave topology among brokers.

In my activemq-broker.xml I have

/        <persistenceAdapter>
			<jdbcPersistenceAdapter dataDirectory="activemq-data"
dataSource="#mssql-ds" createTablesOnStartup="false" />
        </persistenceAdapter>/

and 

/ <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://10.100.100.10;DatabaseName=mydb"/>
		<property name="username" value="user"/>
		<property name="password" value="password"/>
 </bean>/

The problem is that when SMX starts the activemq broker I get the following
exception

15:09:03,867 | DEBUG | rint Extender: 3 | SQLServerException               |
184 - wrap_mvn_com.microsoft.sqlserver_sqljdbc4_4.0.0 - 0.0.0 | ***
SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR
UPDATE clause allowed only for DECLARE CURSOR. Msg 1003, Level 15, State 2,
Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
15:09:03,867 | DEBUG | rint Extender: 3 | DefaultDatabaseLocker            |
62 - org.apache.activemq.activemq-core - 5.7.0 | Lock failure:
*com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause
allowed only for DECLARE CURSOR.*
com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause
allowed only for DECLARE CURSOR.

I searched in the forums and it seems that SqlServer does not support FOR
UPDATE so the broker cannot take the lock to the database.

Can this be fixed somehow? 

Thanks in advance,
Michalis







--
View this message in context: http://activemq.2283324.n4.nabble.com/SqlServer-Master-Slave-tp4666887.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: SqlServer Master/Slave

Posted by Christian Posta <ch...@gmail.com>.
Thanks for posting your solution!


On Mon, May 13, 2013 at 5:44 AM, Michalis <mi...@gmail.com>wrote:

> I tried JtdsDataSource and everything worked just fine!
>
>         <bean id="mssql-ds"
> class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
>                    <property name="serverName" value="10.100.100.10"/>
>                    <property name="portNumber" value="1433"/>
>                    <property name="databaseName" value="test"/>
>                    <property name="user" value="test"/>
>                    <property name="password" value="test"/>
>         </bean>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/SqlServer-Master-Slave-tp4666887p4666953.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: SqlServer Master/Slave

Posted by Michalis <mi...@gmail.com>.
I tried JtdsDataSource and everything worked just fine!

	<bean id="mssql-ds" class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
		   <property name="serverName" value="10.100.100.10"/>
		   <property name="portNumber" value="1433"/>
		   <property name="databaseName" value="test"/>
		   <property name="user" value="test"/>
		   <property name="password" value="test"/>
	</bean>



--
View this message in context: http://activemq.2283324.n4.nabble.com/SqlServer-Master-Slave-tp4666887p4666953.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.