What is the Java Language Extension?

Applies to: SQL Server 2019 (15.x) and later versions

The Java Language Extension is a feature of SQL Server used for executing external Java code. The relational data can be used in the external Java code using the extensibility framework. The Java Language Extension is part of SQL Server Language Extensions.

The default Java runtime is Zulu Open JRE. You can also use another Java JRE or SDK.

What you can do with the Java Language Extension

The Java Language Extension uses the extensibility framework for executing external Java code. Code execution is isolated from the core engine processes, but fully integrated with SQL Server query execution. You can execute Java code at the data's source, eliminating the need to pull data across the network.

The external Java language is defined with CREATE EXTERNAL LANGUAGE. The system stored procedure sp_execute_external_script is used as the interface for executing the Java code.

Get started with the Java Language Extension

  1. Install SQL Server Java Language Extension on Windows or on Linux.

  2. Configure development tools.

  3. Write your first Java code. Use the following tutorial as a starting point. Tutorial: Search for a string using regular expressions (regex) in Java


The number of values in input and output buffers can't exceed MAX_INT (2^31-1), since that is the maximum number of elements that can be allocated in an array in Java.