JDBC driver cannot be found when reading a DataSet from an SQL database in Apache Flink
<p>After having followed the beginner Java tutorials for Apache Flink on their <a href="https://ci.apache.org/projects/flink/flink-docs-release-1.1/" rel="nofollow noreferrer">documentation sites</a> I wanted to try some transformations on my own data. However, I'm having trouble gathering input from my <strong>Microsoft SQL database</strong> running on a server in the network. </p>

<p>The examples in the section about <a href="https://ci.apache.org/projects/flink/flink-docs-release-1.1/apis/batch/index.html#data-sources" rel="nofollow noreferrer">possible sources for DataSets</a> contain a section that looked like what I need, where a DataSet is built using env.createInput(...) with a JDBCInputFormat. So I added the Maven dependency for Flink JDBC</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
    &lt;artifactId&gt;flink-jdbc_2.11&lt;/artifactId&gt;
    &lt;version&gt;0.10.2&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<p>and remodeled the given code to fit to my own database like this:</p>

<pre><code>// create and configure input format
JDBCInputFormat inputFormat = JDBCInputFormat.buildJDBCInputFormat()
    .setDrivername("org.apache.derby.jdbc.EmbeddedDriver")
    .setDBUrl(sqlserver)
    .setUsername(username)
    .setPassword(password)
    .setQuery(query)
    .finish();

// create and configure type information for DataSet
TupleTypeInfo typeInformation = new TupleTypeInfo(Tuple2.class, STRING_TYPE_INFO, INT_TYPE_INFO);

// Read data from a relational database using the JDBC input format
DataSet&lt;Tuple2&lt;String, Integer&gt;&gt; dbData = environment.createInput(inputFormat, typeInformation);
</code></pre>

<p>Server address, user name and password are the same that work in another Java program of mine where I use JDBC only. The query is a simple SELECT on two columns, one containing String values, the other Integers. </p>

<p>When running the program I get a <strong>ClassNotFoundException</strong> referring to the selected driver: <code>JDBC-Class not found. - org.apache.derby.jdbc.EmbeddedDriver at org.apache.flink.api.java.io.jdbc.JDBCInputFormat.open</code></p>

<p>Now, I seem to be missing some imports here, but I can't figure out which (and where to get them), as I was expecting Flink JDBC to support this minimal example. The same driver name is also given in the JDBCInputFormat Javadoc. I tried adding JDBC 4.2 manually which did not work. </p>

<p><strong>What do I need to add or change so that the driver will be found?</strong> Additionally, is there some official material about Flink JDBC and its usage, apart from the Javadoc? I am even having difficulties finding tutorials about Flink and SQL sources in general. </p>