http://remark.wordpress.com/2007/07/19/activemq-and-sql-server/
At first, when I tried to use SQL Server (2000) with ActiveMQ there was an error. The error was:
Failed to acquire lock: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
I’m using the jtds jdbc driver. I attached a profiler and the SQL that SQL Server finds offensive is:
SELECT * FROM ACTIVEMQ_LOCK FOR UPDATE
I searched through the Nabble forums for ActiveMQ and found the answer here. My jtds config looks like this:
<bean id="jtds-ds" class="net.sourceforge.jtds.jdbcx.JtdsDataSource"> <property name="serverName" value="localhost"/> <property name="portNumber" value="1433"/> <property name="databaseName" value="databaseName"/> <property name="user" value="userName"/> <property name="password" value="password"/> </bean>
and my persistence adapter is configured like this:
<persistenceAdapter> <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data" dataSource="#jtds-ds" useDatabaseLock="false"/> </persistenceAdapter>
The useDatabaseLock=False being the important bit.
All of which seems to work.