Newer
Older
marking / src / dao / JdbcConnection.java
Mark George on 20 Aug 2017 828 bytes Added reporting.
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/202/2017/marking/project/milestone1/db/marking;IFEXISTS=TRUE";
//   private static final String url = "jdbc:h2:./db/testing;IFEXISTS=TRUE";
	private static final String url = MarkingProperties.jdbcUri();
	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);
      }
   }
}