Microsoft Open Sources Java Language Extension for SQL Server
- By John K. Waters
- April 29, 2020
Microsoft has open sourced the Java language extension it added to SQL Server 2019 last year.
Language extensions are used in SQL Server to allow users to execute code externally for queries. The extensions leverage the Extensibility Framework API to communicate and exchange data with SQL Server. Code execution is isolated from the core engine processes, but fully integrated with SQL Server query execution.
This particular language extension enables secure execution of Java code for a range of scenarios, such as performing advanced text and data preparation tasks, reaching out to external APIs to get data, and training machine learning models and model scoring.
Used in combination with the newly open sourced code of the Java language extension, the Extensible Framework API provides an end-to-end example implementation of how a programming language extension can be built, explained Nellie Gustafsson, senior program manager on Microsoft's SQL Server Product Team, in a blog post, which makes it easier for additional programming language extensions to be built for SQL Server by the community.
"This extension is the first example of using an evolved programming language extensibility architecture, which allows integration with a new type of language extensions," Gustafsson said. "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."
This evolved architecture will make it easier to upgrade the Java runtime, she noted, but it also raises some concerns around support. (Enterprises need support contracts.) To address this concern, Redmond is partnering with Azul Systems. All Azure and SQL Server customers can now 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 with SQL Server out of the box.
Bringing Java workloads closer to the data opens a variety of possibilities, Gustafsson wrote. She listed a number of use cases for Java inside SQL Server:
- This extends the T-SQL (Transact-SQL) surface area to better handle use cases involving regular expressions, string handling, and Natural Language Processing 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 back-end 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.
Microsoft has published a tutorial for both creating a language extension and using the Java language extension for SQL Server.
About the Author
John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS. He can be reached at [email protected].