为MSSQL Server docker映像启用XA事务 [英] Enable XA transactions for MSSQL Server docker image

查看:244
本文介绍了为MSSQL Server docker映像启用XA事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用于开发的MSSQL Server Linux docker映像,我需要在此实例上启用XA事务,我进行了很多搜索,但发现的所有教程仅显示如何从Windows计算机(而不是Linux)执行此操作.

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.

因此,如何从命令行启用XA事务,或者是否有相应的配置文件.

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

推荐答案

在用于Linux的SQLServer 2016和2017中,无法使用XA事务.从适用于Linux的SqlServer 2019开始(在撰写本文时为预览),

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

然后您应该能够通过以下方式启用JDBC XA支持:

EXEC sp_sqljdbc_xa_install

用户需要具有权限:

 use master;
 sp_grantdbaccess 'myuser', 'myuser';
 EXEC sp_addrolemember [SqlJDBCXAUser], 'myuser'

这篇关于为MSSQL Server docker映像启用XA事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆