Microsoft JDBC驱动程序和jTDS JDBC驱动程序中的XA数据源

蜜蜂

我对SQL Server有点陌生,并且正在与之连接的Java应用程序中工作。我找到了这两个著名的JDBC驱动程序,微软的一个和jTDS的一个。我正在尝试使用XA数据源。

根据Microsoft文档,这里说我必须配置服务器,然后才能使用XA数据源。根据该文档,它要求执行的操作是在服务器中启用XA。

但是我看不到jTDS需要任何这样的服务器端修改。(我在这里找不到任何文档这样说

因此,我的问题是,jTDS本身如何在服务器中启用XA,而Microsoft却需要我执行启用任务?

还是我在这里想念什么?

蜜蜂

在深入研究jTDS驱动程序发行版之后,找到了答案。它具有README.XA文件,说明了一切。复制下面的内容。

XA support in jTDS
==================

This version of jTDS includes a XADataSource class which allows the driver to
be used with J2EE servers that only support XA JDBC connections. The class name
is net.sourceforge.jtds.jdbcx.JtdsDataSource.

By default the driver will emulate distributed transactions fooling the J2EE
environment into believing that two phase commit is supported. This emulation
has the serious drawback that when used in a true distributed environment, the
driver may not be able to commit or rollback when requested by the transaction
manager. In this situation data loss or corruption can occur.

In general this emulation is safe to use when jTDS is the only transactional
resource manager or where the database is read only and never updated.
Emulation is much faster than support for true distributed transactions and
this may be another reason to consider using the driver in this mode if the
risks are understood.

Many J2EE servers provide their own XA emulations that allow the normal
net.sourceforge.jtds.jdbc.Driver to be used. The recommendation is to use the
vendor's emulation, if available, rather than the XADataSource as this
configuration is likely to be more stable.

The driver will support true distributed transactions with MS SQL2000 provided
that the extended stored procedure in JtdsXA.dll is installed in the target
server. To disable the XA emulation and use the stored procedure, set the
connection property "xaemulation" to "false". This implementation is very
immature and cannot be recommended for production use at this stage. It may
however be useful for development when true two phase commit support is
required.

Another connection property, "LogFile" has been added to JtdsDataSource which
allows the jTDS logging to be enabled in a J2EE environment. The parameter
value specifies the output file path for the logging information.

Two example configurations for the popular JBoss server are included in the
conf directory. One configuration uses the Driver interface and the server's XA
emulation the other shows how to use the driver's XA support in either emulated
or real mode.


Installing JtdsXA.dll
=====================

For true distributed transaction support JtdsXA.dll has to be installed on the
server. The installation procedure consists of two simple steps:

 1. Copy JtdsXA.dll from the XA directory to the <SQL_Server_Root>/binn
    directory of the SQL Server installation.

 2. From the command prompt run the following command in the directory where
    you extracted jTDS:

    isql -Usa -P<sa_password> -S<server_name_or_ip> -iXA\instjtds.sql

    Alternatively, use any DB tool (such as Query Analyzer or any JDBC tool) to
    execute the script within the 'master' database. Don't forget to log in as
    'sa'.

This will install the xp_jtdsxa extended stored procedure, used by jTDS to
provide true distributed transacition support.

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

JDBC驱动程序和驱动程序

java.sql.SQLException:找不到适用于jdbc:microsoft:sqlserver的驱动程序

ms sql microsoft的jdbc驱动程序和jTDS的驱动程序之间的差异

JTDS驱动程序过时了吗?

JDBC驱动程序与网桥

加载JDBC驱动程序

Microsoft SQL Server CE(精简版)3.5的jdbc驱动程序

使用数据源(Java Eclipse)时,“找不到适合jdbc的驱动程序”

了解Oracle JDBC驱动程序中的defaultRowPrefetch和defaultBatchValue

在MS SQL上缓存HikariCP语句(Microsoft JDBC驱动程序4.1)

为什么我的代码不断获取java.sql.SQLException:[Microsoft] [ODBC Driver Manager]数据源名称未找到且未指定默认驱动程序?

Tomcat 8上带有jTDS JDBC驱动程序的AbstractMethodError

无法使用Jmeter创建类'com.microsoft.sqlserver.jdbc.SQLServerDriver'的JDBC驱动程序

结合使用TLSv1.2和Microsoft JDBC驱动程序和Oracle JRE 7

vb6连接到mysql:[Microsoft] [ODBC驱动程序管理器]找不到数据源名称,未指定默认驱动程序

VB6连接到MySQL5.7.16 [Microsoft] [ODBC Driver Manager]找不到数据源名称,未指定默认驱动程序

在VSTS中运行JMeter负载测试时,无法加载JDBC驱动程序类'com.microsoft.sqlserver.jdbc.SQLServerDriver'错误显示

OpenJPA-ArgumentException:JDBC驱动程序或数据源类名称

Clojure JDBC ODBC“未找到数据源名称且未指定默认驱动程序”

[Microsoft] [用于JDBC的SQLServer 2000驱动程序]值无法转换为请求的类型

Scala和MySQL JDBC驱动程序

Java Hibernate错误“找不到指定的JDBC驱动程序com.microsoft.sqlserver.jdbc.SQLServerDriver类”

Microsoft Server中缺少Microsoft Print to PDF驱动程序

使用XA数据源和最新的MySQL驱动程序的WildFly9,无法设置DefaultFetchSize

Microsoft JDBC 驱动程序 ClassCastException 在 Weblogic 数据源池中抛出

“找不到适合 jdbc:microsoft:sqlserver 的驱动程序”

[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序 [Dynamics GP]

最快的JDBC驱动程序

Wildfly 21:可启动 JAR 找不到 H2 JDBC 驱动程序/数据源类