title: How to fix - Cannot load driver class: com.vertica.jdbc.Driver
body: <p>I am a newbie at Java SpringBoot and am trying to create a simple application which returns result from a select query in Vertica database</p>
  
  <p>In my <code>application.properties</code> file I have created a database connection like this </p>
  
  <pre><code>spring.datasource.url=jdbc:vertica://&lt;URL&gt;:&lt;Port&gt;/&lt;DB&gt;
  spring.datasource.username=&lt;username&gt;
  spring.datasource.password=&lt;password&gt;
  spring.datasource.driver-class-name=com.vertica.jdbc.Driver
  </code></pre>
  
  <p>And I have a <code>RestController</code> defined like this -</p>
  
  <pre><code>package com.example.demo3;
  
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.persistence.EntityManager;
  import javax.persistence.Query;
  import javax.persistence.PersistenceContext;
  import java.util.List;
  
  @RestController
  public class QueryExecutor {
  
      @PersistenceContext
      private EntityManager entityManager;
  
      @RequestMapping(value = "/", method = RequestMethod.POST)
      public List ExecuteQuery () {
          Query query = entityManager.createNativeQuery("select * from schema.mytable");
          return query.getResultList();
      }
  }
  </code></pre>
  
  <p>And these are the dependencies in my <code>pom.xml</code></p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>But when I compile my project I get below error -</p>
  
  <pre><code>java.lang.IllegalStateException: Cannot load driver class: com.vertica.jdbc.Driver 
  </code></pre>
  
  <p>I have download and placed the vertica driver <code>vertica-jdbc-9.2.1-0.jar</code> under <code>C:\Users\&lt;windowsuser&gt;\Sun\Java</code> and I have this jar file path in <code>Path</code> variable in <code>User variables</code> and <code>Path</code> variable in <code>System variables</code> in <code>System Properties</code>. Also in <code>intelliJ Idea IDE</code> in <code>application.properties</code> file the <code>com.vertica.jdbc.Driver</code> value is in red and gives error <code>Cannot resolve class or package vertica</code>.</p>
  
  <p>How can I successfully register the vertica database driver in my windows 10 machine?</p>