Java 将oracleDataSource更改为PostgreSQL

Java 将oracleDataSource更改为PostgreSQL,java,oracle,postgresql,Java,Oracle,Postgresql,我有这个功能 public OracleDataSource dataSource() throws SQLException { if (dataSource == null) { dataSource = new OracleDataSource(); dataSource.setUser(username); dataSource.setPassword(password); d

我有这个功能

public OracleDataSource dataSource() throws SQLException {
        if (dataSource == null) {
            dataSource = new OracleDataSource();
            dataSource.setUser(username);
            dataSource.setPassword(password);
            dataSource.setURL(url);
            dataSource.setImplicitCachingEnabled(true);
            dataSource.setFastConnectionFailoverEnabled(true);
        }
        return dataSource;
    }

我需要更改从oracle到postresql db的交换,OracleDataSource中有一些等价物用于Postrgesql?

org.postgresql.ds.PGConnectionPoolDataSource
org.postgresql.ds.PGSimpleDataSource

有关详细信息,请参阅