当前位置: 首页>>代码示例>>Java>>正文


Java PGSimpleDataSource.setUrl方法代码示例

本文整理汇总了Java中org.postgresql.ds.PGSimpleDataSource.setUrl方法的典型用法代码示例。如果您正苦于以下问题:Java PGSimpleDataSource.setUrl方法的具体用法?Java PGSimpleDataSource.setUrl怎么用?Java PGSimpleDataSource.setUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.postgresql.ds.PGSimpleDataSource的用法示例。


在下文中一共展示了PGSimpleDataSource.setUrl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataSources

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
@Parameters(name = "{index}:{0}")
public static Collection<DataSource> getDataSources() {
    List<DataSource> dataSources = new ArrayList<>();

    dataSources.add(newH2DataSource());

    // MySQL
    if (HekateTestProps.is("MYSQL_ENABLED")) {
        MysqlDataSource mysql = new MysqlDataSource();

        mysql.setURL(HekateTestProps.get("MYSQL_URL"));
        mysql.setUser(HekateTestProps.get("MYSQL_USER"));
        mysql.setPassword(HekateTestProps.get("MYSQL_PASSWORD"));

        dataSources.add(mysql);
    }

    // PostgreSQL
    if (HekateTestProps.is("POSTGRES_ENABLED")) {
        PGSimpleDataSource postgres = new PGSimpleDataSource();

        postgres.setUrl(HekateTestProps.get("POSTGRES_URL"));
        postgres.setUser(HekateTestProps.get("POSTGRES_USER"));
        postgres.setPassword(HekateTestProps.get("POSTGRES_PASSWORD"));

        dataSources.add(postgres);
    }

    return dataSources;
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:31,代码来源:JdbcSeedNodeProviderTest.java

示例2: withPosgresSimpleDataSource

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
private DataSource withPosgresSimpleDataSource() {
    PGSimpleDataSource ds = new PGSimpleDataSource();
    ds.setUrl(String.format("jdbc:postgresql://%s:%s/%s", hostname, port, database));
    ds.setUser(username);
    ds.setPassword(password);
    return ds;
}
 
开发者ID:carlomorelli,项目名称:muon-app,代码行数:8,代码来源:DataSourceFactory.java

示例3: createPGDataSource

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
public static PGSimpleDataSource createPGDataSource(String connString, String connUser, String connPassword) {
    PGSimpleDataSource source = new PGSimpleDataSource();
    source.setUrl(connString);
    source.setUser(connUser);
    source.setPassword(connPassword);
    return source;
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:8,代码来源:DBUtils.java

示例4: configure

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
@Override
protected void configure() {
  final Map<String, String> properties = new HashMap<>();
  properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());

  final String dbUrl = System.getProperty("jdbc.url");
  final String dbUser = System.getProperty("jdbc.user");
  final String dbPassword = System.getProperty("jdbc.password");

  waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);

  properties.put(JDBC_URL, dbUrl);
  properties.put(JDBC_USER, dbUser);
  properties.put(JDBC_PASSWORD, dbPassword);
  properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));

  JpaPersistModule main = new JpaPersistModule("main");
  main.properties(properties);
  install(main);
  final PGSimpleDataSource dataSource = new PGSimpleDataSource();
  dataSource.setUser(dbUser);
  dataSource.setPassword(dbPassword);
  dataSource.setUrl(dbUrl);
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(dataSource, "che-schema", "codenvy-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).to(JpaCleaner.class);

  bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
      .toInstance(new JpaTckRepository<>(InviteImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(InviteDao.class).to(JpaInviteDao.class);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:38,代码来源:JpaIntegrationTckModule.java

示例5: INIT

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
public static synchronized void INIT() {

        PGSimpleDataSource ds = new PGSimpleDataSource();
        ds.setUrl(PG_URL);

        try (final Connection cnx = ds.getConnection(); final Statement st = cnx.createStatement()) {
            st.execute(TestSuite.getResourceAsString(PG_SQL));
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }

        TestSuite.setupSessionFactoryBuilder(ds);
    }
 
开发者ID:javaplugs,项目名称:mybatis-types,代码行数:14,代码来源:PostgresqlSuite.java

示例6: prepareTestingDataSource

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
public static DataSource prepareTestingDataSource() {
    PGSimpleDataSource source = new PGSimpleDataSource();
    source.setUrl("jdbc:postgresql://localhost:5432/pivots_test");
    return source;
}
 
开发者ID:enocom,项目名称:json-api-java,代码行数:6,代码来源:SqlTestingUtils.java

示例7: buildDataSource

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
private DataSource buildDataSource() {
    PGSimpleDataSource dataSource = new PGSimpleDataSource();
    dataSource.setUrl("jdbc:postgresql://localhost/example_test");
    return dataSource;
}
 
开发者ID:enocom,项目名称:json-api-java,代码行数:6,代码来源:DatabaseMovieRepositoryTest.java

示例8: init

import org.postgresql.ds.PGSimpleDataSource; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws SQLException, IOException {
    PGSimpleDataSource pgDs = new PGSimpleDataSource();
    pgDs.setUrl(PG_URL);
    sessionFactory = JsonHandlersTestApi.setUpDb(pgDs, PG_SQL);
}
 
开发者ID:javaplugs,项目名称:mybatis-jackson,代码行数:7,代码来源:PostgresqlTest.java


注:本文中的org.postgresql.ds.PGSimpleDataSource.setUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。