Today we are pleased to announce availability of the Community Technology Preview (CTP) of the Microsoft JDBC 4.2 Driver for SQL Server! The driver provides robust data access to Microsoft SQL Server and Microsoft Azure SQL Database for Java-based applications.

The JDBC Driver for SQL Server is a Java Database Connectivity (JDBC) type 4 driver that implements full compliance with the JDBC specifications 4.1 and 4.2 and supports Java Development Kit (JDK) version 1.8. There are several additional enhancements available with the driver.  The updated XA Transaction feature includes new timeout options for automatic rollback of unprepared transactions. And, 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.

To use the SQLServerBulkCopy class, the basic flow is: connect to the source, then connect to the destination SQL Server or Azure SQL Database, create the SQLServerBulkCopy object and call WriteToServer.  The sample code below illustrates how the new class works:

// 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);

 

// Default options are shown here

SQLServerBulkCopyOptions options = new SQLServerBulkCopyOptions();

options.setBatchSize(0);

options.setBulkCopyTimeout(30);

options.setCheckConstraints(false);

options.setFireTriggers(false);

options.setKeepIdentity(false);

options.setKeepNulls(false);

options.setTableLock(true);

options.setUseInternalTransaction(false);

 

SQLServerBulkCopy operation = new SQLServerBulkCopy(destConnection, options);

operation.setDestinationTableName("DestinationTable");

operation.addColumnMapping(1, 1);

operation.addColumnMapping(2, "test2");

operation.addColumnMapping("test3", 3);

operation.addColumnMapping("test4", "test4");

 

// Perform the copy

operation.writeToServer(resultSet);

 

// Finished

operation.close();

For more details about what is currently supported in the bulk copy feature preview, please refer to What’s New in the JDBC driver.

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

You can download the JDBC 4.2 driver preview hereWe invite you to explore the latest the Microsoft Data Platform has to offer via a trial of Microsoft Azure SQL Database or by trying the new SQL Server 2016 CTP. We look forward to hearing your feedback about the new driver. Let us know what you think on Microsoft Connect.


SQL Server Team Blog

{ Comments on this entry are closed }

How To Not Post Crappy Pics Of Fireworks This Fourth Of July

July 4, 2015

The temptation will be great. The urge will be strong. Watching sky-based explosions, geared toward entertainment and celebration, can be a powerful experience. And in the Instagram Age, the powerful experiences are the ones we want to share. But the July 5th edition of Instagram usually sucks pretty hard, based mostly on blurry, drunkenly captured […]

Read the full article →

Azure Data Services for Predictive Analytics

July 3, 2015

In my last post I hopefully explained that business intelligence works very well on Azure and with new services like the Azure Data Warehouse and Power BI (Not strictly part of Azure but a Microsoft  online service).  However while BI is good at showing some trends and how a limited number of factors affect that […]

Read the full article →

Fabled CD SNES-compatible “Play Station” prototype found

July 3, 2015

At the 1989 Consumer Electronics Show in Las Vegas, Nintendo of America’s then-chairman Howard Lincoln took the stage to reveal some unexpected news: the company was partnering with European electronics firm Philips to make a CD-ROM-based games console. While the announcement took everyone in the audience by surprise, Sony engineer Ken Kutaragi was the most […]

Read the full article →

Dynamically Setting Variables as Over-writable during Gather

July 3, 2015

During the MDT Gather process, almost all properties (variables) are treated as “first writer wins” (i.e. the value cannot be changed during Gather once it is set for the first time).  ZTIGather.xml defines the “known” MDT variables for Gather.  The ones that are able to be changed (overwritten) during Gather have the property overwrite="true".  Any […]

Read the full article →

Express yourself in email: hundreds more themes, plus emoji

July 2, 2015

Posted by Gaurav Vijay, Software Engineer Your inbox is home to some of your most meaningful and entertaining messages—from that acceptance letter, to those throwback photos—so we think it’s important for Gmail to feel just as personal (and fun!). That’s why we offer lots of ways to customize your experience—from inbox categories, to email formatting, […]

Read the full article →

Writing Data to the MDT Database During Gather

July 2, 2015

MDT allow you to query the MDT Database during a Gather step using database sections in CustomSetting.ini.  This is great for retrieving settings to drive the deployment.  However, there are occasions where you may want to write information back to the database.  MDT provides no built-in way to do this.  Michael Niehaus provided a PowerShell […]

Read the full article →

SQL Server 2016 launches new rapid preview model with CTP 2.1

July 1, 2015

From Tiffany Wissner, Senior Director, Data Platform In the SQL Server CTP 2 blog, T.K. Ranga Rengarajan, CVP of SQL Server engineering, discussed bringing cloud first innovations to SQL Server 2016. This includes a rapid preview model that exists in Microsoft Azure today.  With the release of SQL Server 2016 Community Technology Preview (CTP) 2.1, for […]

Read the full article →

Rocket Internet And Kinnevik Add $167M More To GFG, Roll In 2 Brazilian Fashion Portals

July 1, 2015

 Rocket Internet’s Global Fashion Group (GFG), an umbrella group that houses the German company’s fashion-focused e-commerce services, is making a double announcement today after it secured €150 million ($ 167 million) in fresh funding and made two acquisitions in Brazil. Read More TechCrunch

Read the full article →

Rocket Internet And Kinnevik Add $167M More To GFG, Roll In 2 Brazilian Fashion Portals

July 1, 2015

 Rocket Internet’s Global Fashion Group (GFG), an umbrella group that houses the German company’s fashion-focused e-commerce services, is making a double announcement today after it secured €150 million ($ 167 million) in fresh funding and made two acquisitions in Brazil. Read More TechCrunch

Read the full article →