private PGPoolingDataSource createDataSource(String dbName) {
   PGPoolingDataSource dataSource;
   dataSource = new PGPoolingDataSource();
   dataSource.setUser("admin");
   dataSource.setPassword("admin");
   dataSource.setServerName("localhost");
   dataSource.setDatabaseName(dbName);
   return dataSource;
 }
Esempio n. 2
0
 @Bean
 public DataSource dataSource() {
   final PGPoolingDataSource source = new PGPoolingDataSource();
   source.setDataSourceName("cloudoholiq");
   source.setServerName("localhost");
   source.setDatabaseName("cloudoholiq");
   source.setUser("postgres");
   source.setPassword("postgres");
   source.setMaxConnections(10);
   return source;
 }
Esempio n. 3
0
 public DBConnection() {
   source = new PGPoolingDataSource();
   // source.setDataSourceName("A Data Source");
   source.setServerName(this.HOST);
   source.setPortNumber(this.PORT);
   source.setDatabaseName(this.DB);
   source.setUser(this.USER);
   source.setPassword(this.PASSWORD);
   // source.setMaxConnections(20);//Максимальное значение
   source.setInitialConnections(1); // Сколько соединений будет сразу открыто
 }