Language Extensions is a feature of SQL Server used for executing external code. The relational data can be used in the external code using the extensibility framework.
For more information about SQL Server Language Extensions, refer to this documentation.
The Java extension version in this repository is compatible with SQL Server 2019 CU3 onwards.
This tutorial will walk you through an end to end sample using the Java language extension for SQL Server. Sample code files for the tutorial can also be found under samples in this repository. Sample code files are also available in this repository.
- The Java components in this project are built on Java 8
- The Microsoft Extensibility SDK for Java is also installed as part of SQL Server 2019 on both Windows as Linux
- Default installation path on Windows: [instance installation home directory]\MSSQL\Binn\mssql-java-lang-extension.jar
- Default installation path on Linux: /opt/mssql/lib/mssql-java-lang-extension.jar
-
Install CMake for Windows and Java (file and instructions)
-
Install C++ Tools for CMake from the Build Tools for Visual Studio 2017. Download the Visual Studio 2017 Build Tools installer and check the Visual C++ build tools option under Workloads. In the sidebar on the right, make sure Visual C++ tools for CMake is checked, then install.
-
Set CMAKE_ROOT and JAVA_HOME pointing to the respective folders.
-
Run build-java-extension.cmd which will generate two main files:
- PATH\TO\ENLISTMENT\build-output\java-extension\windows\release\release\java-extension.dll
- PATH\TO\ENLISTMENT\build-output\java-extension\target\release\mssql-java-lang-extension.jar -
Run create-java-extension-zip.cmd which will generate:
- PATH\TO\ENLISTMENT\build-output\java-extension\windows\release\release\packages\java-lang-extension.zip
This zip can be used in CREATE EXTERNAL LANGUAGE, as detailed in the tutorial in the Usage section below.
-
Install CMake for Linux and Java
-
Set JAVA_HOME pointing to the Java folder.
-
Run build-java-extension.sh which will generate two main files:
- PATH/TO/ENLISTMENT/build-output/java-extension/linux/release/libJavaExtension.so.1.0
- PATH/TO/ENLISTMENT/build-output/java-extension/target/release/mssql-java-lang-extension.jar -
Run create-java-extension-zip.sh which will generate:
- PATH/TO/ENLISTMENT/build-output/java-extension/linux/release/packages/java-lang-extension.zip
This zip can be used in CREATE EXTERNAL LANGUAGE, as detailed in the tutorial in the Usage section below.
After creating the Java extension zip, use CREATE EXTERNAL LANGUAGE to create the language on the SQL Server.
This tutorial will walk you through an end to end sample using the Java language extension.