Transitioning from jTDS to Microsoft's JDBC driver

Bitbucket を SQL Server に接続する

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

This page describes how to change from using jTDS to using the Microsoft SQL Server JDBC driver to access Microsoft SQL Server.

What do I have to do?

If Bitbucket Data Center and Server was configured to use Microsoft SQL Server by following the steps outlined in Connect Bitbucket to SQL Server no change is necessary. However, if Bitbucket was configured to use Microsoft SQL Server by manually entering a JDBC URL, the system will lock on startup if the driver class and URL are not manually updated.

How to proceed

In the home directory, bitbucket.properties must be edited to change the JDBC driver and URL. The existing configuration should look similar to this:

jdbc.driver=net.sourceforge.jtds.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://localhost:1433;databaseName=stash;
jdbc.user=stashuser
jdbc.password=secretpassword

(warning) The JDBC URL above is in the format constructed by Bitbucket when connecting Bitbucket to SQL Server and will automatically be updated to a URL compatible with Microsoft's driver, with no change required on the administrator's part.  If the URL contains additional properties, such as domain=, it will need to be manually updated.

To use Microsoft's SQL Server driver, the settings above would be updated to this:

jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1433;databaseName=stash;
jdbc.user=stashuser
jdbc.password=secretpassword

The exact values to use in the new URL are beyond the scope of this documentation; they must be chosen based on the jTDS settings they are replacing.

Additional Information

The new JDBC driver class is: com.microsoft.sqlserver.jdbc.SQLServerDriver

The JDBC URL format for the jTDS driver is documented on SourceForge at http://jtds.sourceforge.net/faq.html#urlFormat.

The JDBC URL format for Microsoft's SQL Server driver is documented on MSDN at http://msdn.microsoft.com/en-us/library/ms378428.aspx, with documentation for additional properties at http://msdn.microsoft.com/en-us/library/ms378988.aspx.

Why change drivers?

Click here to find all the technical details...

Recent releases of Hibernate, which Bitbucket uses to simplify its persistence layer, have introduced a requirement that the JDBC drivers and connection pools used be JDBC4-compliant. JDBC4 was introduced with Java 6.

The jTDS driver used by releases prior to Bitbucket 2.1 is a JDBC3 driver, compatible with Java 1.3, and therefore cannot be used with newer versions of Hibernate. While jTDS 1.3.0 and 1.3.1 claim to implement JDBC4, and JDBC4.1, they actually don't. The new methods have been "implemented", but their implementations are all throw new AbstractMethodError(), which means they can't actually be used. (See an example here, on GitHub.)

Since jTDS 1.3.1 does not provide a functioning JDBC4 implementation, the decision was made to replace jTDS with Microsoft's own SQL Server driver. Microsoft's driver is actively maintained, where jTDS hasn't been updated since 2014 (and prior to the small round of updates done in 2014 it hadn't been updated for multiple years). Microsoft offers a full JDBC4.2 (Java 8) driver and supports all the features of SQL Server, including SQL Server 2016.

Bitbucket attempts to automatically update jTDS JDBC URLs to values compatible with Microsoft's JDBC driver. However, for installations using custom JDBC URLs–for example, to use domain authentication–such automatic updating is not possible; the URL, which was manually entered, must be manually updated.

最終更新日 2022 年 6 月 22 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.