Open sourcing the Java language extension for SQL Server
With over 20 years of existence, Java is still one of the most popular programming languages and is used in many enterprise applications.
In SQL Server 2019, we added a Java language extension, which enables secure execution of Java programs in the context of a SQL Server query. This enables a wide range of scenarios such as performing advanced text and data preparation tasks, reaching out to external APIs to get data and also training machine learning models and model scoring.
Today, we’re thrilled to announce that we are open sourcing the Java language extension for SQL Server on GitHub.
This extension is the first example of using an evolved programming language extensibility architecture which allows integration with a new type of language extensions. This new architecture gives customers the freedom to bring their own runtime and execute programs using that runtime in SQL Server while leveraging the existing security and governance that the SQL Server programming language extensibility architecture provides.
Choosing which runtime to use does provide the flexibility to choose different distributions of Java, and as newer versions of the Java runtime get released, this architecture will make it easier to upgrade the Java runtime. However, this freedom may raise some questions around support. Enterprises need to have a support contract in place for their Java runtime. The answer, in this case, is that we’ve got you covered. Thanks to a partnership between Microsoft and Azul, all Azure and SQL Server customers can use Azul’s Zulu for Azure – Enterprise distribution of Java for free with support jointly provided by Microsoft and Azul. This supported distribution of Java is included in SQL Server out of the box!
Now that support is not an issue, let’s look at what use cases Java can enable inside SQL Server. Bringing Java workloads closer to the data opens a variety of possibilities:
- This extends the TSQL surface area to better handle use cases involving regular expressions, string handling, and NLP support.
- This functionality also helps in migration scenarios from Oracle, where applications rely on Oracle Java procs in the database. With the ability to execute Java inside stored procedures in SQL Server, there is now a path for enabling Java application migrations to SQL Server.
- Java application development teams that leverage SQL Server as backend storage can now even embed Java code in stored procedures which enables pushing business logic down into the database for better performance.
- Furthermore, this will help avoid unnecessary data movement and latency when data must be retrieved from SQL Server and moved into the app tier to do the business logic processing.
Why Open Source?
The Java language extension leverages the Extensibility Framework API for SQL Server to communicate and exchange data with SQL Server. This API has been publicly documented. The API in combination with the open source code of the Java language extension provides an end to end example implementation of how a programming language extension can be built. This makes it easier for additional programming language extensions to be built for SQL Server by the community. What language extensions would you like to see?
Get started
Whether you are interested in creating your own language extension or just using the Java language extension for SQL Server, here is a tutorial to get you started.