Enable XA transactions for MSSQL Server docker image

六眼飞鱼酱① 提交于 2019-12-12 18:25:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!