JDBC 4.2 SQL Server Driver 发布

jopen 9年前

JDBC 4.2 SQL Server Driver 发布

Microsoft has released the Community Technology Preview (CTP) of the Microsoft JDBC 4.2 Driver for SQL Server. According to official sources, the driver providers robust data access to Microsoft SQL Server and Microsoft Azure SQL Database for Java-based applications. It includes support for Java Development Kit (JDK) version 1.8.

Microsoft has updated XA Transaction feature which includes new timeout options for automatic rollback of unprepared transactions. Moreover, the new SQLServerBulkCopy class enables developers to quickly copy large amounts of data into tables or views in SQL Server and Azure SQL Database databases from other databases.

JDBC 4.2 SQL Server Driver 发布

In order to use the SQLServerBulkCopy class, you need to follow the following steps

  • Connect to the source
  • Connect to the destination SQL Server or Azure SQL Database
  • Create the SQLServerBulkCopy object
  • Call WriteToServer

The SQL Server Team has published a sample code on the official blog which examines the usage of the new class.

// Obtain data from the source by connecting and loading it into a ResultSet  Connection sourceConnection = DriverManager.getConnection(connectionUrl);  String SQL = "SELECT * FROM SourceTable";  Statement stmt = sourceConnection.createStatement();  ResultSet resultSet = stmt.executeQuery(SQL);  // Prepare for SQL Bulk Copy Operation  Connection destConnection = DriverManager.getConnection(connectionUrl);

The JDBC driver is part of the Microsoft Data Platform’s wider interoperability program with drivers for PHP 5.6, Node.js, JDBC, ODBC and ADO.NET.

Microsoft has invited developers to test drive Microsoft Data Platform via a trial of Microsoft Azure SQL Database or by making use of SQL Server 2016 CTP.


来自:http://less2css.com/blog/2015/07/13/jdbc-4-2-sql-server-driver/?ref=dzone