title: org.apache.tomcat.jdbc.pool.DataSource missing
body: <p>i need your help with my code. I have a PoolConnector class with this code:</p>
  
  <pre><code>package db;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  import org.apache.tomcat.jdbc.pool.DataSource;
  import org.apache.tomcat.jdbc.pool.PoolProperties;
  
  public class PoolConnector
  
  {
  
  private static final String user = "root";
  private static final String password = "";
  private static final String dbUrl = "jdbc:mysql://localhost/gene_ontology";
  private static DataSource ds;
  
  static {
      try {
          Context context = new InitialContext();
          Context envctx =  (Context) context.lookup("java:comp/env");
          ds =  (DataSource) envctx.lookup("jdbc/TestDB");
      } 
      catch (NamingException ex) {
          Logger.getLogger(PoolConnector.class.getName()).log(Level.SEVERE, null, ex);
          PoolProperties p = new PoolProperties();
          p.setUrl("jdbc:mysql://localhost/gene_ontology?autoReconnect=true");
          p.setDriverClassName("com.mysql.jdbc.Driver");
          p.setUsername("root");
          p.setPassword("");
          p.setJmxEnabled(true);
          p.setTestWhileIdle(false);
          p.setTestOnBorrow(true);
          p.setValidationQuery("SELECT 1");
          p.setTestOnReturn(false);
          p.setValidationInterval(30000);
          p.setTimeBetweenEvictionRunsMillis(30000);
          p.setMaxActive(100);
          p.setInitialSize(10);
          p.setMaxWait(10000);
          p.setRemoveAbandonedTimeout(60);
          p.setMinEvictableIdleTimeMillis(30000);
          p.setMinIdle(10);
          p.setLogAbandoned(true);
          p.setRemoveAbandoned(true);
          p.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
          ds = new DataSource();
          ds.setPoolProperties(p);
      }
  }
  
  public static Connection getConnection()
  {
      Connection conn = null;
      try 
      {    
          conn =
                  DriverManager.getConnection(dbUrl, user, password);
      }
  
      catch (SQLException e)
      {
          e.printStackTrace();
      }
      finally 
      {
          return conn;
      }
  }
  
  public static Connection getConnection(boolean pool)
  {
      if (pool)
      {
          Connection conn = null;
          try
          {
  
              conn = ds.getConnection();
              return conn;
          }
          catch (SQLException e)
          {
              e.printStackTrace();
              return null;
          }
      }
      else return getConnection();
  }
  
  public static boolean closeConnection(Connection conn)
  {
      try 
      {
          conn.close();
          return true;
      } 
      catch (SQLException ex) 
      {
          Logger.getLogger(Connector.class.getName()).log(Level.SEVERE, 
                  "Connection could not be closed", ex);
          return false;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I get an error for two packages, it seems that they do not exist 
  (import org.apache.tomcat.jdbc.pool.DataSource;
  import org.apache.tomcat.jdbc.pool.PoolProperties;)</p>
  
  <p>what am I doing wrong?
  Thank you in advance.</p>