title: Netezza connection with Spark / Scala JDBC
body: <p>I've set up Spark 2.2.0 on my Windows machine using Scala 2.11.8 on IntelliJ IDE.  I'm trying to make Spark connect to Netezza using JDBC drivers.  </p>
  
  <p>I've read through <a href="https://developer.ibm.com/hadoop/2016/02/19/reading-netezza-data-spark-sql-data-souce/" rel="nofollow noreferrer">this link</a> and added the <code>com.ibm.spark.netezza</code>jars to my project through Maven.  I attempt to run the Scala script below just to test the connection:</p>
  
  <pre><code>package jdbc
  object SimpleScalaSpark {
    def main(args: Array[String]) {
      import org.apache.spark.sql.{SparkSession, SQLContext}
      import com.ibm.spark.netezza
  
      val spark = SparkSession.builder
        .master("local")
        .appName("SimpleScalaSpark")
        .getOrCreate()
  
      val sqlContext = SparkSession.builder()
        .appName("SimpleScalaSpark")
        .master("local")
        .getOrCreate()
  
  val nzoptions = Map("url" -&gt; "jdbc:netezza://SERVER:5480/DATABASE",
    "user" -&gt; "USER",
    "password" -&gt; "PASSWORD",
    "dbtable" -&gt; "ADMIN.TABLENAME")
  
  val df = sqlContext.read.format("com.ibm.spark.netezza").options(nzoptions).load()
    }
  }
  </code></pre>
  
  <p>However I get the following error:</p>
  
  <pre><code>17/07/27 16:28:17 ERROR NetezzaJdbcUtils$: Couldn't find class org.netezza.Driver
  java.lang.ClassNotFoundException: org.netezza.Driver
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at org.apache.spark.sql.execution.datasources.jdbc.DriverRegistry$.register(DriverRegistry.scala:38)
      at com.ibm.spark.netezza.NetezzaJdbcUtils$$anonfun$getConnector$1.apply(NetezzaJdbcUtils.scala:49)
      at com.ibm.spark.netezza.NetezzaJdbcUtils$$anonfun$getConnector$1.apply(NetezzaJdbcUtils.scala:46)
      at com.ibm.spark.netezza.DefaultSource.createRelation(DefaultSource.scala:50)
      at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:306)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:146)
      at jdbc.SimpleScalaSpark$.main(SimpleScalaSpark.scala:20)
      at jdbc.SimpleScalaSpark.main(SimpleScalaSpark.scala)
  Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:netezza://SERVER:5480/DATABASE
      at java.sql.DriverManager.getConnection(DriverManager.java:689)
      at java.sql.DriverManager.getConnection(DriverManager.java:208)
      at com.ibm.spark.netezza.NetezzaJdbcUtils$$anonfun$getConnector$1.apply(NetezzaJdbcUtils.scala:54)
      at com.ibm.spark.netezza.NetezzaJdbcUtils$$anonfun$getConnector$1.apply(NetezzaJdbcUtils.scala:46)
      at com.ibm.spark.netezza.DefaultSource.createRelation(DefaultSource.scala:50)
      at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:306)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:146)
      at jdbc.SimpleScalaSpark$.main(SimpleScalaSpark.scala:20)
      at jdbc.SimpleScalaSpark.main(SimpleScalaSpark.scala)
  </code></pre>
  
  <p>I have two ideas: </p>
  
  <p>1) I don't don't believe I actually installed any Netezza JDBC driver, though I thought the jars I brought into my project from the link above was sufficient.  Am I just missing a driver or am I missing something in my Scala script?  </p>
  
  <p>2) In the same link, the author makes mention of starting the Netezza Spark package:</p>
  
  <blockquote>
    <p>For example, to use the Spark Netezza package with Spark’s interactive
    shell, start it as shown below:</p>
    
    <p>$SPARK_HOME/bin/spark-shell –packages
    com.ibm.SparkTC:spark-netezza_2.10:0.1.1
    –driver-class-path~/nzjdbc.jar</p>
  </blockquote>
  
  <p>I don't believe I'm invoking any package apart from <code>jdbc</code> in my script.  Do I have to add that to my script?</p>
  
  <p>Thanks!</p>