问题
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.
回答1:
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'
来源:https://stackoverflow.com/questions/40900016/enable-xa-transactions-for-mssql-server-docker-image