SQL Server 2005 JDBC Driver 1.0 error in using XA datasource

We are in the process of configuring a j2ee application with SQL Server 2005. We have downloaded the new version of SQL Server 2005 Java Database Connectivity (JDBC) Driver 1.0.

We are having some issues in getting it to work using the XA datasource. Description of the error is as follows:

javax.transaction.xa.XAException: java.sql.SQLException: Failed to create the XA control connection. Error: Could not find stored procedure 'master..xp_sqljdbc_xa_init'..
at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(Unknown Source)

Has anyone else has encountered this and possibly found a solution.

Regards,

Bindu



Answer this question

SQL Server 2005 JDBC Driver 1.0 error in using XA datasource

  • Gideon Raveh

    Name:
    The name of this JDBC connection pool.
    URL:
    The URL of the database to connect to. The format of the URL varies by JDBC driver.
    Driver Classname:
    The full package name of JDBC driver class used to create the physical database connections in the connection pool. (Note that this driver class must be in the classpath of any server to which it is deployed.)
    Properties:
    The list of properties passed to the JDBC driver that are used to create physical database connections. For example: server=dbserver1. List each property=value pair on a separate line.
    Password:
    Confirm Password:
    The database account password used in the physical database connection.
    Open String Password:
    Confirm Open String Password:
    The password for the XA open string. (If set, this value overrides a password in an open string in Properties.)

    Settings in Connection tab are all default. With this setting, older JDBC was working fine.


  • Schu

    BTW, SQL Server 2005 JDBC Driver 1.0 is working well in Windows 2003. I see this problem in Windows XP.
  • Wa5h

    Hi Matt,

    Thanks for your quick response. As per the instructions provided in xa_install.txt file , I copied sqljdbc_xa.dll to the Binn directory, the same folder where sqlservr.exe resides.
    I installed MSDTC on the SQL Server and enabled the XA tranactions after checking "Enable XA Transactions". Later I stopped and restarted the MSDTC and SQL Server service.
    After following the above steps am encountering the following error:

    javax.transaction.xa.XAException: java.sql.SQLException: Failed to create the XA control connection. Error: xp_sqljdbc_xa_init failure, status:0 msg:*** SQLJDBC_XA DTC_ERROR Context: xa_init, state=1, StatusCode:0 (0x00000000) ***.
    at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(Unknown Source)

    Please suggest to me how I can overcome this problem.

    Regards,
    Bindu


  • nielsvdc

    Hi sorry for the delay, my alerts are not working.

    I suspect this is due to a known bug we recently found if you have sendStringParametersAsUnicode=false in the connection string this breaks XA connections.

    So workaround for now is to not use sendStringParametersAsUnicode=false in connection string, I will find out when a fix will be available.

    Note we now have a release of the driver with a fix for this sendStringParametersAsUnicode issue (and one other XA fix) so be sure to get this and test it out first ->

    This is the CTP release of the next version of the driver:

    http://blogs.msdn.com/angelsb/archive/2006/04/20/580233.aspx



  • xanthus

    Do you have a date for when this will be ported to XP
  • khawari

    I have a exactly same problem. I copyed sqljdbc_xa.dll to SQL server directory and executed xa_install.sql but got the following message.

    javax.transaction.xa.XAException: java.sql.SQLException: Failed to create the XA control connection.
    Error: xp_sqljdbc_xa_init failure, status:0 msg:*** SQLJDBC_XA DTC_ERROR Context: xa_init, state=1,
    StatusCode:0 (0x00000000) ***.

    I want to try workaround but couldn't find the parameter setting for sendStringParamtersAsUnicode. I'm using Weblogic 8.1. Where can I find this setting


  • y2k4life

    Aha. Windows XP is the key here. XA transactions do not currently work when the SQL Server is installed on Windows XP. You will need to have SQL Server installed on Windows 2000 or Windows 2003.

    Issue #2 in xa_install.txt directs you to apply hotfix http://support.microsoft.com/kb/318818 for XA transactions to work on XP.

    However, this hotfix has not yet been ported to Windows XP (it is currently available only for Windows 2000).

    Hope this helps,

    --David Olix

    JDBC Development


  • Brad House

    Hi folks, just an update.

    Some bad news for those running SQL Server on XP and trying to get XA transactions working with this setup.

    While doing more extensive stress testing on the XP hotfix myself and I ran into some additional issues so the Windows group needs to do some more work on the fix and re-package and re-release the hotfix.  Plan is for the fix to be available Mid-June.

    So for now if your SQL Server is running on XP then XA transactions will not work until we re-release this XP hotfix.



  • Schmlughtz

    Hi,

    Could you post back with how you configured the connection string in WebLogic 8.1

    Specifically all of the connection string parameters you supplied (make sure to strip out things that might be sensitive of course).

    Matt



  • Tammy!

    Also have this problem - this page was the only one I could find on Google referring to it *arg*
  • dityaprirody

    I encountered the same problem today and would like to know what must be done to resolve this issue.
  • Kyderoy

    I'm running into this problem with JBoss. SQL Server 2005 is running on 2003.

    I set "sendStringParametersAsUnicode" to false but I'm now getting a slightly different error:

    http-0.0.0.0-9090-Processor25 2006-04-19 10:14:49,468 | WARN | session=none | user=none | org.jboss.tm.TransactionImpl | XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=jeitzman240_rck/18, BranchQual=, localId=18] errorCode=XA_UNKNOWN(0)
    javax.transaction.xa.XAException: java.sql.SQLException: Failed to create the XA control connection. Error: xp_sqljdbc_xa_init failure, status:0 msg:* * * S Q L J D B C _ X A D T C _ E R R O R C o n t e x t : x a _ i n i t , s t a t e = 1 , S t a t u s C o d e : 0 ( 0 x 0 0 0 0 0 0 0 0 ) * * * .
    at com.microsoft.sqlserver.jdbc.SQLServerXAResource.start(Unknown Source)
    at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:131)
    at org.jboss.tm.TransactionImpl$Resource.startResource(TransactionImpl.java:1951)
    at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:548)

  • glenmaclarty

    Read the xa_install.txt file that ships with the driver, there is some additional setup you have to do to get the XA transactions working.

    Pasting in the text:

    This installation is required if you want to use XA data sources in
    conjunction with Microsoft Distributed Transaction Coordinator.

    1. Ensure Microsoft Distributed Transaction Coordinator is installed
    and running on every SQL Server machine that will participate in
    distributed transactions.

    2. Copy the sqljdbc_xa.dll from this directory to the Binn directory
    of every SQL Server machine that will participate in distributed transactions.

    NOTE:

    If you are on a 32-bit processor, please use the sqljdbc_xa.dll
    file in the folder x86.

    If you are on a 64-bit x64 processor, please use the sqljdbc_xa.dll
    file in the folder x64.

    3. Execute the database script xa_install.sql on every SQL Server
    machine that will participate in distributed transactions.

    4. To grant permissions to a specific user to participate in
    distributed transactions with the Microsoft SQL Server 2005
    JDBC Driver, add the user to the SqlJDBCXAUser role.



  • fabianus

    Didn't get a chance to try this; couldn't find that value in my connection string. I was using Websphere 5.1.1.1 as my application container; perhaps it was adding it automatically.

    Instead "solved" the problem by uninstalling SQL Server 2005 and installed SQL Server 2000 Evaluation (SQL Server 2000 Standard doesn't work with XP!) from http://www.microsoft.com/technet/prodtechnol/sql/2000/downloads/default.mspx and things seemed to work (with the 2000 JDBC drivers). The software will expire in 180 days, but it's good enough for development work.


  • SQL Server 2005 JDBC Driver 1.0 error in using XA datasource