Newsletters




The Java Language Extension for SQL Server Is Now Open Source


Microsoft continues to make positive strides in the world of open source. The company once considered open source software to be an anathema, but now it’s common for Microsoft to pull software from—and also push software to—the open source software community. On the pull side, Microsoft has brought several high-quality open source tools into Azure SQL Notebooks. Now, we are seeing this behavior in the other direction as Microsoft has decided to move its Java language extensions into the world of open source via the GitHub software sharing platform at https://github.com/microsoft/sql-server-language-extensions/tree/master/language-extensions/java.

Java in SQL Server

Microsoft added Java language extensions with the release of SQL Server 2019 so that users could take advantage of secure execution of Java programs within a SQL Server query on the Zulu Open JRE (Java runtime environment) or other JRE and SDK (software development kit) runtimes. Java, one of the world’s most popular programming languages, was a natural choice for a SQL Server language extension since it is so widely used for enterprise applications. Embedding Java into SQL Server facilitates a wide variety of coding use cases in which T-SQL (Microsoft Transact-SQL) would not perform as well, such as advanced text manipulation, data wrangling, pulling data through external APIs, machine learning model scoring, and training machine learning models.

There are many other ways to take advantage of having Java code within your workloads, such as the following:

Enabling extensions to T-SQL: Java gives you better handling for complex strings, natural language processing, and regular expressions.

Migrating from Oracle: Oracle owns Java and uses it extensively across its product lines, including in stored procedures within Oracle Database. Now that SQL Server also has Java within its SQL code, you have a new path to migrate Java applications to SQL Server.

Pushing business logic into the database: Teams that are accustomed to developing in Java and utilize SQL Server as their data storage back end can now embed their code directly into SQL Server, obtaining a performance boost by putting Java and the back end together. This can result in a reduction in unnecessary data movement and latency since the app tier and business logic are now down within SQL Server.

Java in SQL Server in Open Source Software

This feature set is an example of a broader language extensions capability released in SQL Server 2018 that allows you to utilize SQL Server’s relational data in external code using an extensibility framework. (More details are available at https://docs.microsoft.com/en-us/sql/language-extensions/language-extensions-overview??view=sql-server-ver15). You define an external language such as Java using the CREATE EXTERNAL LANGUAGE T-SQL statement and execute the external code using the sp_execute_external_script system stored procedure.

Many enterprises do not like to implement open source software solutions unless they can also purchase support. In anticipation of this enterprise-level requirement, Microsoft has partnered with a company called Azul Systems to provide users with Java support. This Java support is offered through its Zulu Embedded product and extends to not only the Java language extensions, but everywhere Java is used in SQL Server, including PolyBase, Apache Spark, and more. (More details are available at https://cloudblogs.microsoft.com/sqlserver/2019/07/24/free-supported-java-in-sql-server-2019-is-now-available).

There is no additional cost for Zulu Embedded. It has been built into SQL Server 2019 since CTP 3.2 and is fully licensed for use in both development and production environments. The product includes a variety of features, such as regular security updates backed by a strict service level agreement, advanced profiling with Zulu Mission Control, and fully open source builds that are TCK (technology compatibility kit)-tested and certified. Read more about Azul Zulu Enterprise at www.azul.com/products/zulu-enterprise.

Another reason that customers may enjoy using Azul Zulu Enterprise is that Oracle Java SE support costs have been rising steadily since 2018 and are now non-trivial to the bottom line. Switching to Azul Zulu Enterprise will save you a lot of money compared to using Oracle Java SE. (Details about Oracle’s Java support options and road map are at www.oracle.com/java/tech?nologies/java-se-support-roadmap.html).

Next Steps for the Java and SQL Server User

The best place to get started is https://aka.ms/sqldev, which takes you to the SQL Server developer resource center, where you can find out more about programming for SQL Server using a variety of languages such as Ruby, C#, Go, Node.js, and Java.

If you’re looking for a solid “Hello World” sample application, then check out the tutorial to build the Java code that enables you to search for a string in SQL Server using a regular express (regex). This sample code is online at https://docs.microsoft.com/en-us/sql/language-extensions/tutorials/search-for-string-using-regular-expressions-in-java?view=sql-server-ver15


Sponsors