Package org.postgresql.ds

Examples of org.postgresql.ds.PGConnectionPoolDataSource


  static GPSTraceDAO gpsTraceDAO;
  static Logger logger = Logger.getLogger(SpeedBinTests.class);
 
  public static void createJNDIContext() throws Exception
  {
    PGConnectionPoolDataSource ds = new PGConnectionPoolDataSource();
    ds.setServerName("localhost");
    ds.setPortNumber(5432);
    ds.setDatabaseName("tamt15");
    ds.setUser("gis");
    ds.setPassword("gis");
    ds.setDefaultAutoCommit(true);
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockIntialContextFactory.class.getName());
    InitialContext ic = new InitialContext();
    ic.bind("TAMTDataSource", ds);
  }
View Full Code Here


  static Logger logger = Logger.getLogger(DatabaseDumpTests.class);
 
  public static void createJNDIContext() throws Exception
  {
    PGConnectionPoolDataSource ds = new PGConnectionPoolDataSource();
    ds.setServerName("localhost");
    ds.setPortNumber(5432);
    ds.setDatabaseName("tamt15");
    ds.setUser("gis");
    ds.setPassword("gis");
    ds.setDefaultAutoCommit(true);
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockIntialContextFactory.class.getName());
    InitialContext ic = new InitialContext();
    ic.bind("TAMTDataSource", ds);
  }
View Full Code Here

  static final Logger logger = Logger.getLogger(TAMTConnectionPoolInitializer.class);
  
    public void init() throws ServletException {
     
    logger.debug("Initializing database connection source with JNDI");
    PGConnectionPoolDataSource source = new PGConnectionPoolDataSource();
    source.setServerName("localhost");
    source.setPortNumber(5432);
    source.setDatabaseName("tamt15");
    source.setUser("gis");
    source.setPassword("gis");
    source.setDefaultAutoCommit(true);
   
    try {
      new InitialContext().rebind("TAMTDataSource", source);
    } catch (NamingException e) {
      logger.error("Could not initialize database connection source:" + e.getMessage());
View Full Code Here

  static TripStatisticsReportDAO tripStatisticsReportDAO;
  static Logger logger = Logger.getLogger(ReportTests.class);
 
  public static void createJNDIContext() throws Exception
  {
    PGConnectionPoolDataSource ds = new PGConnectionPoolDataSource();
    ds.setServerName("localhost");
    ds.setPortNumber(5432);
    ds.setDatabaseName("tamt15");
    ds.setUser("gis");
    ds.setPassword("gis");
    ds.setDefaultAutoCommit(true);
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockIntialContextFactory.class.getName());
    InitialContext ic = new InitialContext();
    ic.bind("TAMTDataSource", ds);
  }
View Full Code Here

  static Logger logger = Logger.getLogger(RegionBOTests.class);
  static RegionBO regionBO = RegionBO.get();
 
  public static void createJNDIContext() throws Exception
  {
    PGConnectionPoolDataSource ds = new PGConnectionPoolDataSource();
    ds.setServerName("localhost");
    ds.setPortNumber(5432);
    ds.setDatabaseName("tamt15");
    ds.setUser("gis");
    ds.setPassword("gis");
    ds.setDefaultAutoCommit(true);
    System.setProperty(Context.INITIAL_CONTEXT_FACTORY, MockIntialContextFactory.class.getName());
    InitialContext ic = new InitialContext();
    ic.bind("TAMTDataSource", ds);
  }
View Full Code Here

     */
    if( connection == null)
    {
      //logger.debug("Connection is null, get one from the pool");
      try {
        PGConnectionPoolDataSource source = (PGConnectionPoolDataSource)new InitialContext().lookup("TAMTDataSource");
          connection = source.getConnection();
      } catch(SQLException e) {
          // log error
        logger.debug("SQLException: " + e.getMessage());
      } catch(NamingException e) {
          // DataSource wasn't found in JNDI
        logger.debug("JNDI naming exception: " + e.getMessage());
      } finally {
          //if(connection != null) {
          //    try {connection.close();}catch(SQLException e) {}
          //}
      }
    } else {
     
      try {
        if( connection.isClosed())
        {
          try {
            PGConnectionPoolDataSource source = (PGConnectionPoolDataSource)new InitialContext().lookup("TAMTDataSource");
              connection = source.getConnection();
          } catch(SQLException e) {
              // log error
            logger.debug("SQLException: " + e.getMessage());
          } catch(NamingException e) {
              // DataSource wasn't found in JNDI
View Full Code Here

TOP

Related Classes of org.postgresql.ds.PGConnectionPoolDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.