title: How to add a JDBC driver to a Jenkins pipeline?
body: <p>I want to create a database within a pipeline script to be used by the deployed app. But first I started testing the connection. I got this problem:</p>
  
  <pre><code>java.sql.SQLException: No suitable driver found for jdbc:mysql://mysql:3306/test_db
  </code></pre>
  
  <p>I have the database plugin and the MySQL database plugin installed. </p>
  
  <p>How do I get the JDBC driver?</p>
  
  <pre><code>import groovy.sql.Sql
  node{
  
      def sql = Sql.newInstance("jdbc:mysql://mysql:3306/test_db", "user","passwd", "com.mysql.jdbc.Driver")
      def rows = sql.execute "select count(*) from test_table;"
      echo rows.dump()
  }
  </code></pre>
  
  <p><strong>Update after albciff answer:</strong></p>
  
  <p>My versions of:</p>
  
  <pre><code>Jenkins = 2.19.1
  
  Database plugin = 1.5
  
  Mysql database plugin = 1.1
  </code></pre>
  
  <p>The latest test script.</p>
  
  <pre><code>import groovy.sql.Sql
  
  Class.forName("com.mysql.jdbc.Driver")
  </code></pre>
  
  <p>Which throws:</p>
  
  <pre><code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 
  </code></pre>