Skip to content

Commit d943e66

Browse files
committed
Install, how-to, and TOC update
1 parent 16959f0 commit d943e66

5 files changed

Lines changed: 387 additions & 72 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Create a Java jar file from class files
3+
titleSuffix: SQL Server Language Extensions
4+
description: Learn how to create a Java jar file from class files
5+
author: dphansen
6+
ms.author: davidph
7+
manager: cgronlun
8+
ms.date: 05/15/2019
9+
ms.topic: overview
10+
ms.prod: sql
11+
ms.technology: language-extensions
12+
monikerRange: ">=sql-server-ver15||=sqlallproducts-allversions"
13+
---
14+
# What is SQL Server Language Extensions?
15+
[!INCLUDE[tsql-appliesto-ssver15-xxxx-xxxx-xxx](../includes/tsql-appliesto-ssver15-xxxx-xxxx-xxx.md)]
16+
17+
When executing a Java code from SQL Server, we recommend to package your class files into a jar file.
18+
19+
## Create a jar file
20+
21+
To create a jar from class files, navigate to the folder containing your class file and run this command:
22+
23+
```cmd
24+
jar -cf <MyJar.jar> *.class
25+
```
26+
27+
Make sure the path to **jar.exe** is part of the system path variable. Alternatively, specify the full path to jar which can be found under /bin in the JDK folder. For example:
28+
29+
```cmd
30+
C:\Users\MyUser\Desktop\jdk1.8.0_201\bin\jar -cf <MyJar.jar> *.class
31+
```

‎docs/language-extensions/install/install-sql-server-language-extensions-on-windows.md‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ For local installations, you must run Setup as an administrator. If you install
118118

119119
If you did not install the JDK or JRE under program files, you need to perform the following steps. Run the **icacls** commands from an *elevated* line to grant access to the **SQLRUsergroup** and SQL Server service accounts (in **ALL_APPLICATION_PACKAGES**) for accessing the JRE. The commands will recursively grant access to all files and folders under the given directory path.
120120

121-
### SQLRUserGroup permissions
121+
1. Give SQLRUserGroup permissions
122122

123-
For a named instance, append the instance name to SQLRUsergroup (for example, `SQLRUsergroupINSTANCENAME`).
123+
For a named instance, append the instance name to SQLRUsergroup (for example, `SQLRUsergroupINSTANCENAME`).
124124

125-
```cmd
126-
icacls "<PATH to JRE>" /grant "SQLRUsergroup":(OI)(CI)RX /T
127-
```
128-
129-
You can skip this step if you installed the JDK/JRE in the default folder under program files on Windows.
130-
131-
### AppContainer permissions
125+
```cmd
126+
icacls "<PATH to JRE>" /grant "SQLRUsergroup":(OI)(CI)RX /T
127+
```
128+
129+
You can skip this step if you installed the JDK/JRE in the default folder under program files on Windows.
132130
133-
```cmd
134-
icacls "PATH to JRE" /grant "ALL APPLICATION PACKAGES":(OI)(CI)RX /T
135-
```
131+
2. Give AppContainer permissions
136132
133+
```cmd
134+
icacls "<PATH to JRE>" /grant "ALL APPLICATION PACKAGES":(OI)(CI)RX /T
135+
```
136+
137137
## Enable script execution
138138
139139
1. Open [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)].
@@ -225,6 +225,7 @@ To ensure that language extensions jobs are prioritized and resourced appropriat
225225
226226
If you are using Standard Edition and do not have Resource Governor, you can use Dynamic Management Views (DMVs) and Extended Events, as well as Windows event monitoring, to help manage the server resources.
227227
228+
228229
## Next steps
229230
230231
Java developers can get started with some simple examples, and learn the basics of how Java works with SQL Server. For your next step, see the following links:
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
---
2+
title: Install SQL Server Machine Language Extensions (Java) on Linux | Microsoft Docs
3+
description: Learn how to install SQL Server Language Extensions (Java) on Red Hat, Ubuntu, and SUSE.
4+
author: dphansen
5+
ms.author: davidph
6+
manager: cgronlun
7+
ms.date: 05/15/2019
8+
ms.topic: conceptual
9+
ms.prod: sql
10+
ms.custom: "sql-linux"
11+
ms.technology: language-extensions
12+
monikerRange: ">=sql-server-ver15||>=sql-server-linux-ver15||=sqlallproducts-allversions"
13+
---
14+
# Install SQL Server 2019 Language Extensions (Java) on Linux
15+
16+
[SQL Server Machine Learning Services](../advanced-analytics/what-is-sql-server-machine-learning.md) runs on Linux operating systems starting in this preview release of SQL Server 2019. Follow the steps in this article to install the Java language extension.
17+
18+
Language Extensions are an add-on to the database engine. Although you can [install the database engine and Language Extensions concurrently](#install-all), it's a best practice to install and configure the SQL Server database engine first so that you can resolve any issues before adding more components.
19+
20+
Package location for the Java extensions are in the SQL Server Linux source repositories. If you already configured source repositories for the database engine install, you can run the **mssql-server-extensibility-java** package install commands using the same repo registration.
21+
22+
Language Extensions is also supported on Linux containers. We do not provide pre-built containers with Language Extensions, but you can create one from the SQL Server containers using [an example template available on GitHub](https://github.com/Microsoft/mssql-docker/tree/master/linux/preview/examples/mssql-mlservices).
23+
24+
## Uninstall previous CTP
25+
26+
The package list has changed over the last several CTP releases, resulting in fewer packages. We recommend uninstalling CTP 2.x to remove all previous packages before installing CTP 3.0. Side-by-side installation of multiple versions is not supported.
27+
28+
### 1. Confirm package installation
29+
30+
You might want to check for the existence of a previous installation as a first step. The following files indicate an existing installation: checkinstallextensibility.sh, exthost, launchpad.
31+
32+
```bash
33+
ls /opt/microsoft/mssql/bin
34+
```
35+
36+
### 2. Uninstall previous CTP 2.x packages
37+
38+
Uninstall at the lowest package level. Any upstream package dependent on a lower-level package is automatically uninstalled.
39+
40+
+ For Java integration, remove **mssql-server-extensibility-java**
41+
42+
Commands for removing packages appear in the following table.
43+
44+
| Platform | Package removal command(s) |
45+
|-----------|----------------------------|
46+
| RHEL | `sudo yum remove msssql-server-extensibility-java` |
47+
| SLES | `sudo zypper remove msssql-server-extensibility-java` |
48+
| Ubuntu | `sudo apt-get remove msssql-server-extensibility-java`|
49+
50+
### 3. Proceed with CTP 3.0 install
51+
52+
Install at the highest package level using the instructions in this article for your operating system.
53+
54+
For each OS-specific set of installation instructions, *highest package level* is either **Example 1 - Full installation** for the full set of packages, or **Example 2 - Minimal installation** for the least number of packages required for a viable installation.
55+
56+
1. Run install commands using the package managers and syntax for your Linux distribution:
57+
58+
+ [RedHat](#RHEL)
59+
+ [Ubuntu](#ubuntu)
60+
+ [SUSE](#suse)
61+
62+
## Prerequisites
63+
64+
+ The Linux version must be [supported by SQL Server](sql-server-linux-release-notes-2019.md#supported-platforms), but does not include the Docker Engine. Supported versions include:
65+
66+
+ [Red Hat Enterprise Linux (RHEL)](quickstart-install-connect-red-hat.md)
67+
68+
+ [SUSE Enterprise Linux Server](quickstart-install-connect-suse.md)
69+
70+
+ [Ubuntu](quickstart-install-connect-ubuntu.md)
71+
72+
+ You should have a tool for running T-SQL commands. A query editor is necessary for post-install configuration and validation. We recommend [Azure Data Studio](https://docs.microsoft.com/sql/azure-data-studio/download?view=sql-server-2017#get-azure-data-studio-for-linux), a free download that runs on Linux.
73+
74+
## Package list
75+
76+
On an internet-connected device, packages are downloaded and installed independently of the database engine using the package installer for each operating system. The following table describes all available packages.
77+
78+
| Package name | Applies-to | Description |
79+
|--------------|----------|-------------|
80+
|mssql-server-extensibility | All | Extensibility framework used to run Java code. |
81+
|mssql-server-extensibility-java | Java | Java extension for loading a Java execution environment. There are no additional libraries or packages for Java. |
82+
83+
<a name="RHEL"></a>
84+
85+
## Install Language Extensions
86+
87+
You can install Language Extensions and Java on Linux by installing **mssql-server-extensibility-java**. When you install **mssql-server-extensibility-java**, the package automatically installs JRE 8 if it is not already installed. It will also add the JVM path to an environment variable called JRE_HOME.
88+
89+
> [!Note]
90+
> On an internet-connected server, package dependencies are downloaded and installed as part of the main package installation. If your server is not connected to the internet, see more details in the [offline setup](#offline-install).
91+
92+
### RedHat install command
93+
94+
You can install Language Extensions for Java on RedHat using the command below.
95+
96+
> [!Tip]
97+
> If possible, run `yum clean all` to refresh packages on the system prior to installation.
98+
99+
```bash
100+
# Install as root or sudo
101+
sudo yum install mssql-server-extensibility-java
102+
```
103+
104+
<a name="ubuntu"></a>
105+
106+
### Ubuntu install command
107+
108+
You can install Language Extensions for Java on Ubuntu using the command below.
109+
110+
> [!Tip]
111+
> If possible, run `apt-get update` to refresh packages on the system prior to installation. Additionally, some docker images of Ubuntu might not have the https apt transport option. To install it, use `apt-get install apt-transport-https`.
112+
113+
```bash
114+
# Install as root or sudo
115+
sudo apt-get install mssql-server-extensibility-java
116+
```
117+
118+
<a name="suse"></a>
119+
120+
### SUSE install command
121+
122+
You can install Language Extensions for Java on SUSE using the command below.
123+
124+
```bash
125+
# Install as root or sudo
126+
sudo zypper install mssql-server-extensibility-java
127+
```
128+
129+
## Post-install config (required)
130+
131+
1. Grant permissions on Linux
132+
133+
You don't need to perform this step if you are using external libraries. The recommended way of working is using external libraries. For help creating an external library from your jar file, see [CREATE EXTERNAL LIBRARY](https://docs.microsoft.com/sql/t-sql/statements/create-external-library-transact-sql)
134+
135+
If you are not using external libraries, you need to provide SQL Server with permissions to execute the Java classes in your jar.
136+
137+
To grant read and execute access to a jar file, run the following **chmod** command on the jar file. We recommend always putting your class files in a jar when you work with SQL Server. For help creating a jar, see [How to create a jar file](https://docs.microsoft.com/sql/language-extensions/how-to/create-a-java-jar-file-from-class-files).
138+
139+
```cmd
140+
chmod ug+rx <MyJarFile.jar>
141+
```
142+
143+
You also need to give mssql_satellite permissions the jar file to read/execute.
144+
145+
```cmd
146+
chown mssql_satellite:mssql_satellite <MyJarFile.jar>
147+
```
148+
149+
Additional configuration is primarily through the [mssql-conf tool](sql-server-linux-configure-mssql-conf.md).
150+
151+
2. Add the mssql user account used to run the SQL Server service. This is required if you haven't run the setup previously.
152+
153+
```bash
154+
sudo /opt/mssql/bin/mssql-conf setup
155+
```
156+
157+
3. Enable outbound network access. Outbound network access is disabled by default. To enable outbound requests, set the "outboundnetworkaccess" Boolean property using the mssql-conf tool. For more information, see [Configure SQL Server on Linux with mssql-conf](sql-server-linux-configure-mssql-conf.md#mlservices-outbound-access).
158+
159+
```bash
160+
# Run as SUDO or root
161+
# Enable outbound requests over the network
162+
sudo /opt/mssql/bin/mssql-conf set extensibility outboundnetworkaccess 1
163+
```
164+
165+
4. Restart the SQL Server Launchpad service and the database engine instance to read the updated values from the INI file. A restart message reminds you whenever an extensibility-related setting is modified.
166+
167+
```bash
168+
systemctl restart mssql-launchpadd
169+
170+
systemctl restart mssql-server.service
171+
```
172+
173+
5. Enable external script execution using Azure Data Studio or another tool like SQL Server Management Studio (Windows only) that runs Transact-SQL.
174+
175+
```bash
176+
EXEC sp_configure 'external scripts enabled', 1
177+
RECONFIGURE WITH OVERRIDE
178+
```
179+
180+
6. Restart the Launchpad service again.
181+
182+
## Verify installation
183+
184+
Java feature integration does not include libraries, but you can run `grep -r JRE_HOME /etc` to confirm creation of the JAVA_HOME environment variable.
185+
186+
To validate installation, run a T-SQL script that executes a system stored procedure invoking Java. You will need a query tool for this task. Azure Data Studio is a good choice. Other commonly used tools such as SQL Server Management Studio or PowerShell are Windows-only. If you have a Windows computer with these tools, use it to connect to your Linux installation of the database engine.
187+
188+
<a name="install-all"></a>
189+
190+
## Chained "combo" install
191+
192+
You can install and configure the database engine and Machine Learning Services in one procedure by appending Java packages and parameters on a command that installs the database engine.
193+
194+
1. Provide a command line that includes the database engine, plus language extension features.
195+
196+
You can add Java extensibility to a database engine install.
197+
198+
```bash
199+
sudo yum install -y mssql-server mssql-server-extensibility-java
200+
```
201+
202+
3. Accept license agreements and complete the post-install configuration. Use the **mssql-conf** tool for this task.
203+
204+
```bash
205+
sudo /opt/mssql/bin/mssql-conf setup
206+
```
207+
208+
You will be prompted to accept the license agreement for the database engine, choose an edition, and set the administrator password.
209+
210+
4. Restart the service, if prompted to do so.
211+
212+
```bash
213+
sudo systemctl restart mssql-server.service
214+
```
215+
216+
## Unattended installation
217+
218+
Using the [unattended install](https://docs.microsoft.com/sql/linux/sql-server-linux-setup#unattended) for the Database Engine, add the packages for mssql-server-extensibility-java.
219+
220+
<a name="offline-install"></a>
221+
222+
## Offline installation
223+
224+
Follow the [Offline installation](sql-server-linux-setup.md#offline) instructions for steps on installing the packages. Find your download site, and then download specific packages using the package list below.
225+
226+
> [!Tip]
227+
> Several of the package management tools provide commands that can help you determine package dependencies. For yum, use `sudo yum deplist [package]`. For Ubuntu, use `sudo apt-get install --reinstall --download-only [package name]` followed by `dpkg -I [package name].deb`.
228+
229+
#### Download site
230+
231+
You can download packages from [https://packages.microsoft.com/](https://packages.microsoft.com/). All of the packages for Java are co-located with database engine package.
232+
233+
#### RedHat/7 paths
234+
235+
|||
236+
|--|----|
237+
| mssql/extensibility-java packages | [https://packages.microsoft.com/rhel/7/mssql-server-preview/](https://packages.microsoft.com/rhel/7/mssql-server-preview/) |
238+
239+
#### Ubuntu/16.04 paths
240+
241+
|||
242+
|--|----|
243+
| mssql/extensibility-java packages | [https://packages.microsoft.com/ubuntu/16.04/mssql-server-preview/pool/main/m/](https://packages.microsoft.com/ubuntu/16.04/mssql-server-preview/pool/main/m/) |
244+
245+
#### SUSE/12 paths
246+
247+
|||
248+
|--|----|
249+
| mssql/extensibility-java packages | [https://packages.microsoft.com/sles/12/mssql-server-preview/](https://packages.microsoft.com/sles/12/mssql-server-preview/) |
250+
251+
#### Package list
252+
253+
Depending on which extensions you want to use, download the packages necessary for a specific language. Exact filenames include platform information in the suffix, but the file names below should be close enough for you to determine which files to get.
254+
255+
```
256+
# Core packages
257+
mssql-server-15.0.1000
258+
mssql-server-extensibility-15.0.1000
259+
260+
# Java
261+
mssql-server-extensibility-java-15.0.1000
262+
```
263+
264+
## Limitations in CTP releases
265+
266+
Language Extensions and Java extensibility on Linux is still under active development. The following features are not yet enabled in the preview version.
267+
268+
+ Implied authentication is currently not available on Linux at this time, which means you cannot connect back to the server from in-progress Java to access data or other resources.
269+
270+
271+
### Resource governance
272+
273+
There is parity between Linux and Windows for [Resource governance](../t-sql/statements/create-external-resource-pool-transact-sql.md) for external resource pools, but the statistics for [sys.dm_resource_governor_external_resource_pools](../relational-databases/system-dynamic-management-views/sys-dm-resource-governor-external-resource-pools.md) currently have different units on Linux. Units will align in an upcoming CTP.
274+
275+
| Column name | Description | Value on Linux |
276+
|---------------|--------------|---------------|
277+
|peak_memory_kb | The maximum amount of memory used for the resource pool. | On Linux, this statistic is sourced from the CGroups memory subsystem, where the value is memory.max_usage_in_bytes |
278+
|write_io_count | The total write IOs issued since the Resource Governor statistics were reset. | On Linux, this statistic is sourced from the CGroups blkio subsystem, where the value on the write row is blkio.throttle.io_serviced |
279+
|read_io_count | The total read IOs issued since the Resource Governor statistics were reset. | On Linux, this statistic is sourced from the CGroups blkio subsystem, where value on the read row is blkio.throttle.io_serviced |
280+
|total_cpu_kernel_ms | The cumulative CPU user kernel time in milliseconds since the Resource Governor statistics were reset. | On Linux, this statistic is sourced from the CGroups cpuacct subsystem, where the value on the user row is cpuacct.stat |
281+
|total_cpu_user_ms | The cumulative CPU user time in milliseconds since the Resource Governor statistics were reset.| On Linux, this statistic is sourced from the CGroups cpuacct subsystem, where the value on the system row value is cpuacct.stat |
282+
|active_processes_count | The number of external processes running at the moment of the request.| On Linux, this statistic is sourced from the GGroups pids subsystem, where the value is pids.current |
283+
284+
## Next steps
285+
286+
Java developers can get started with some simple examples, and learn the basics of how Java works with SQL Server. For your next step, see the following links:
287+
288+
+ [Quickstart: Run Java on SQL Server](../language-extensions/quickstarts/run-java-on-sql-server.md)
289+
+ [Tutorial: Regular expressions with Java](../language-extensions/tutorials/java-regular-expressions.md)

0 commit comments

Comments
 (0)