Newer
Older
jetty / src / java / dao / JdbcConnection.java
Mark George on 28 Sep 2017 698 bytes Initial commit.
package dao;



import java.sql.Connection;
import java.sql.SQLException;
import org.h2.jdbcx.JdbcConnectionPool;

/**
 *
 * @author mark
 */
public class JdbcConnection {

   private static final String url = "jdbc:h2:tcp://localhost/~/work/projects/injection/db/users;IFEXISTS=TRUE";
   private static final String username = "sa";
   private static final String password = "";

   private static final JdbcConnectionPool pool = JdbcConnectionPool.create(url, username, password);

   public static Connection getConnection() {
      try {
         return pool.getConnection();
      } catch (SQLException ex) {
         throw new RuntimeException(ex);
      }
   }
}