Building Hello World With Java In SQL Server 2019

Niels Berglund shows how you can use sp_execute_external_script to run Java code in SQL Server 2019:

In SQL Server 2019 Microsoft added the ability to execute custom Java code along the same lines we execute R and Python, and this blog post intends to give an introduction of how to install and enable the Java extension, as well as execute some very basic Java code. In future posts, I drill down how to pass data back and forth between SQL Server and Java.

There may very well be future posts discussing how the internals differ between Java and R/Python, but I want to talk about that a little bit in this post as well, as it has an impact on how we write and call Java code.

The not-so-secret here is that Java itself is less interesting of a language than, say, Scala.  And the reason you’d support Scala?  To interact with an Apache Spark cluster.  I think that’s a big part of why you’d want the installer to load Java 1.8 instead of 1.9 or later (which contain API changes which break Spark).  Definitely give this a careful read, as there are more working parts and more gotchas than R or Python support.

Related Posts

Bash Script Introductions

Kellyn Pot’vin-Gorman continues a series on Bash scripting: For Part II, we’ll start with the BASH script “introduction”. The introduction in a BASH script should begin the same in all scripts.1. Set the shell to be used for the script2. Set the response to failure on any steps, (exit or ignore)3. Add in a step […]

Read More

Problems Distributed Systems Experience

RJ Zaworski gives us examples of the types of problems you can run into with distributed systems: Time limits: ending the neverendingHere’s one to ponder: how long can a long-running action go on before the customer (even a very patient, very digital customer) loses all interest in the outcome?Pull up a chair. With no upper […]

Read More


December 2018
« Nov Jan »