title: Why the error occurs: 'error: package com.mysql does not exist'?
body: <p>I am trying to link a MySQL database to my Jira plugin. I am using Intellij IDEA Community Edition, and it says the syntax is all good. I have the MySQL Connector .jar in my library (added through File-&gt;Project Structure), so it <em>shouldn't</em> be that, unless there is somewhere else I have to add the .jar file that it won't tell me. I had just the MySQL .jar added via downloading from <a href="https://downloads.mysql.com/archives/c-j/" rel="nofollow noreferrer">their website</a> and it wouldn't work. I added the maven MySQL .jar and that didn't work. I added both of them and it still doesn't work. <a href="https://i.stack.imgur.com/Bf3tg.png" rel="nofollow noreferrer">My external libraries</a></p>
  <p>I am getting this error when I compile the plugin:</p>
  <pre><code>Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
  /C:/Users/USER/dynamicSelectCF/src/main/java/PACKAGE/DatabaseConnection.java:[11,1] package com.mysql does not exist
  </code></pre>
  <p>With this code:</p>
  <pre class="lang-java prettyprint-override"><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.util.ArrayList;
  
  import com.mysql.*;
     
  public class DatabaseConnection {
      
      public static ArrayList&lt;String&gt; connection(ArrayList&lt;String&gt; population){
          population.clear();
          population.add(&quot;-------------------&quot;);
  
          Connection connection = null;
          Statement statement = null;
          ResultSet result = null;
          String url = Constants.getUrl();
          String username = Constants.getUsername();
          String password = Constants.getPassword();
          String query = &quot;SELECT name, p_o_allowed FROM database WHERE p_o_allowed LIKE 'P%'&quot;;
  
          try{
              Class.forName(&quot;com.mysql.cj.jdbc.Driver&quot;);
          } catch(ClassNotFoundException e){
              population.add(&quot;mysql driver a no no&quot;);
              population.add(e.getMessage());
              population.add(e.toString());
              e.printStackTrace();
          }
          population.add(&quot;-------------------&quot;);
          try{
              population.add(&quot;trying connection&quot;);
              connection = DriverManager.getConnection(url, username, password);
              population.add(&quot;trying statement&quot;);
              statement = connection.createStatement();
              population.add(&quot;trying result&quot;);
              result = statement.executeQuery(query);
              population.add(&quot;all 3 are a go!&quot;);
  
              while(result.next()){
                  population.add(result.getString(&quot;name&quot;));
              }
          }catch (SQLException e){
              population.add(&quot;Yeah we didn't get in fam&quot;);
              population.add(e.getMessage());
              e.printStackTrace();
          }finally{
              closeResultSet(result);
              closeStatement(statement);
              closeConnection(connection);
          }
          return population;
      }
  </code></pre>
  <p>I also have this in my pom.xml file which is directly from the <a href="https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-installing-maven.html" rel="nofollow noreferrer">MySQL website.</a></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
      &lt;version&gt;8.0.20&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>I know I do not need <code>import com.mysql</code>; however, that is the only way to generate the error on compilation into my terminal otherwise it goes to the try/catch and throws <em>&quot;com.mysql.cj.jdbc.Driver not found by PACKAGE&quot;</em>.</p>
  <p>If you have any question about the population ArrayList, it is for dynamically populating a Select list for the Jira Plugin. And adding those errors and tests allowed me to see them in my Jira dev website.</p>