org.postgresql.Driver.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中org.postgresql.Driver.<init>()方法的一些代码示例,展示了Driver.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Driver.<init>()方法的具体详情如下:
包路径:org.postgresql.Driver
类名称:Driver
方法名:<init>

Driver.<init>介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Inject
public RedshiftClient(JdbcConnectorId connectorId, BaseJdbcConfig config)
{
  super(connectorId, config, "\"", new DriverConnectionFactory(new Driver(), config));
}

代码示例来源:origin: prestodb/presto

@Inject
public PostgreSqlClient(JdbcConnectorId connectorId, BaseJdbcConfig config)
{
  super(connectorId, config, "\"", new DriverConnectionFactory(new Driver(), config));
}

代码示例来源:origin: org.postgresql/postgresql

/**
 * Register the driver against {@link DriverManager}. This is done automatically when the class is
 * loaded. Dropping the driver from DriverManager's list is possible using {@link #deregister()}
 * method.
 *
 * @throws IllegalStateException if the driver is already registered
 * @throws SQLException if registering the driver fails
 */
public static void register() throws SQLException {
 if (isRegistered()) {
  throw new IllegalStateException(
    "Driver is already registered. It can only be registered once.");
 }
 Driver registeredDriver = new Driver();
 DriverManager.registerDriver(registeredDriver);
 Driver.registeredDriver = registeredDriver;
}

代码示例来源:origin: org.postgresql/postgresql

public java.sql.Driver createDriver(Properties props) throws SQLException {
 if (props != null && !props.isEmpty()) {
  throw new PSQLException(GT.tr("Unsupported properties: {0}", props.stringPropertyNames()),
    PSQLState.INVALID_PARAMETER_VALUE);
 }
 return new org.postgresql.Driver();
}

代码示例来源:origin: rakam-io/rakam

@Override
  public Connection openConnection(JDBCSchemaConfig factory)
      throws SQLException {
    Properties properties = new Properties();
    Optional.ofNullable(factory.getPassword())
        .ifPresent(pass -> properties.setProperty("password", pass));
    Optional.ofNullable(factory.getUsername())
        .ifPresent(user -> properties.setProperty("user", user));
    properties.setProperty("loginTimeout", "120");
    properties.setProperty("socketTimeout", "120");
    properties.setProperty("connectTimeout", "120");
    if (factory.getEnableSSL() != null) {
      properties.setProperty("ssl", factory.getEnableSSL().toString());
    }
    return new org.postgresql.Driver().connect(
        format("jdbc:postgresql://%s:%s/%s",
            factory.getHost(),
            Optional.ofNullable(factory.getPort()).orElse(5432),
            factory.getDatabase()), properties);
  }
}, (jdbcSchemaConfig, table) -> ofNullable(jdbcSchemaConfig.getSchema())

代码示例来源:origin: prestosql/presto

@Inject
public PostgreSqlClient(JdbcConnectorId connectorId, BaseJdbcConfig config)
{
  super(connectorId, config, "\"", new DriverConnectionFactory(new Driver(), config));
}

代码示例来源:origin: com.facebook.presto/presto-postgresql

@Inject
public PostgreSqlClient(JdbcConnectorId connectorId, BaseJdbcConfig config)
{
  super(connectorId, config, "\"", new DriverConnectionFactory(new Driver(), config));
}

代码示例来源:origin: prestosql/presto

@Inject
public RedshiftClient(JdbcConnectorId connectorId, BaseJdbcConfig config)
{
  super(connectorId, config, "\"", new DriverConnectionFactory(new Driver(), config));
}

代码示例来源:origin: locationtech/geogig

@VisibleForTesting
int getDriverMinorVersion() {
  return new org.postgresql.Driver().getMinorVersion();
}

代码示例来源:origin: locationtech/geogig

@VisibleForTesting
int getDriverMajorVersion() {
  return new org.postgresql.Driver().getMajorVersion();
}

代码示例来源:origin: org.locationtech.geogig/geogig-postgres

@VisibleForTesting
int getDriverMinorVersion() {
  return new org.postgresql.Driver().getMinorVersion();
}

代码示例来源:origin: org.locationtech.geogig/geogig-postgres

@VisibleForTesting
int getDriverMajorVersion() {
  return new org.postgresql.Driver().getMajorVersion();
}

代码示例来源:origin: com.netflix.metacat/metacat-postgres-connector

/**
 * Constructor.
 * @param connectorId connector id
 * @param config config
 * @throws SQLException SQL exception
 */
@Inject
public MetacatPostgreSqlClient(final JdbcConnectorId connectorId, final BaseJdbcConfig config) throws SQLException {
  super(connectorId, config, "\"", DataSourceManager.get().getDriver(connectorId.toString(), new Driver()));
}

代码示例来源:origin: net.postgis/postgis-jdbc

int major;
try {
  major = new Driver().getMajorVersion();
} catch (Exception e) {
  System.err.println("Cannot create Driver instance: " + e.getMessage());

代码示例来源:origin: postgis/postgis-java

int major;
try {
  major = new Driver().getMajorVersion();
} catch (Exception e) {
  System.err.println("Cannot create Driver instance: " + e.getMessage());

代码示例来源:origin: perspilling/jdbi-examples

public DBI getDBI() {
  if (dbi != null) return dbi;
  if (dbType == DbType.H2) {
    JdbcConnectionPool jdbcConnectionPool =
        JdbcConnectionPool.create(
            DbProperties.DB_URL.val(),
            DbProperties.DB_USERNAME.val(),
            DbProperties.DB_PASSWORD.val());
    dbi = new DBI(jdbcConnectionPool);
  } else {
    try {
      DriverManager.registerDriver(new org.postgresql.Driver());
      return new DBI(
          DbProperties.DB_URL.val(),
          DbProperties.DB_USERNAME.val(),
          DbProperties.DB_PASSWORD.val());
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
  return dbi;
}

相关文章