Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable XA transactions for MSSQL Server docker image

I have MSSQL Server Linux docker image that I use for development and I need to enable XA transactions on this instance, I search a lot but all the tutorials I found show only how to do that from a windows machine, no Linux.

So How to enable XA transactions from command line, or is there a configuration file for that.

like image 959
J.Doe Avatar asked Oct 14 '25 15:10

J.Doe


1 Answers

In SQLServer 2016 and 2017 for Linux it is not possible to use XA transactions. Starting with SqlServer 2019 for Linux (In preview at the time of writing), distributed transaction support has been added.

docker run \
   -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' \
   -e 'MSSQL_RPC_PORT=135' -e 'MSSQL_DTC_TCP_PORT=51000' \
   -p 51433:1433 -p 135:135 -p 51000:51000  \
   -d mcr.microsoft.com/mssql/server:2019-CTP2.3-ubuntu

You should then be able to enable the JDBC XA support with:

EXEC sp_sqljdbc_xa_install

The user needs to have the permissions:

 use master;
 sp_grantdbaccess 'myuser', 'myuser';
 EXEC sp_addrolemember [SqlJDBCXAUser], 'myuser'
like image 131
Markus Heberling Avatar answered Oct 17 '25 05:10

Markus Heberling