I get the following exception in my log when I try to complete an XA transaction:
javax.transaction.xa.XAException: com.microsoft.sqlserver.jdbc_SQLServerException: Failed to create XA control connection. Error: "The EXECUTE permission was denied to the object" xp_sqljdbc_xa_init_ex ", the schema" master "of the database" dbo "
I followed these tutorials Understanding XA Transactions and How to Make MSSQL Server Work Xat Datasource? After completing the first lesson, I also ran the following command in SSMS:
use GO wizard
EXEC sp_addrolemember [SqlJDBCXAUser], 'MyUserName' GO
I will also add that I ran
use the GO EXEC wizard sp_grantdbaccess 'MyUserName', 'MyUserName' GO
to make sure the user has access to master db, and I got the error message "the user already exists in the current database." Finally, through SSMS, he confirmed that the SqlJDBCXAUser role has EXECUTE provided with respect to xp_sqljdbc_xa_init_ex .
The database I'm using is clearly not master , but myDBName . The only correlation between them on this issue is that MyUserName is the owner of myDBName and exists as a user in master .
My server is running Windows XP with Service Pack 3 (so the fix mentioned in the first lesson does not matter, since it is for XP SP2 and below, I know how I tried to run the fix).
Has anyone encountered this issue? I would really appreciate some conclusions.
Thanks,
Ittay
Update:
I looked at the first tutorial starting with Microsoft , and there are two paragraphs that I'm not sure what they mean, and they may contain a solution:
Run the xa_install.sql script database on each instance of SQL Server that will participate in distributed transactions. This script installs the extended stored procedures that sqljdbc_xa.dll calls. These extended stored procedures implement distributed transaction and XA support for the Microsoft SQL Server JDBC driver. You will need to run this script as the administrator of the instance of SQL Server.
When they say SQL Server instance , do they mean a sql server that contains several databases, including master and myDBName (I use terms that are slightly different for the oracle)? I ran xa_install.sql script once when it was specified and it indicates use master .
This is the second paragraph:
Customizing User Defined Roles
To grant permissions to a specific user to participate in distributed transactions with the JDBC driver, add the user to the SqlJDBCXAUser role. For example, use the following Transact-SQL code to add a user named "shelby" to the SqlJDBCXAUser role (a standard SQL user user named "shelby"):
USE master GO EXEC sp_grantdbaccess 'shelby', 'shelby' GO EXEC sp_addrolemember [SqlJDBCXAUser], 'shelby'
User-defined user roles are defined for each database . To create your own security role, you will need to define a role in each database and add users to the database. The role of SqlJDBCXAUser is strictly defined in the main database , as it is used to provide access to the extended JDBC SQL stored procedures, which are located in the main. You must first grant individual users access to the wizard, and then grant them access to the SqlJDBCXAUser role when you log in to the main database.
I'm not sure, but I think the bold sentence above says that the SqlJDBCXAUser role should be defined only on master , and that other users who have access to myDBName should be granted access to master , and then added to the role and will somehow (don't know how) will include them when using the myDBName database to use xa packages.
Update 2: This is a screenshot of SSMS stored procedure security parameters in the role of SqlJDBCXAUser 