java 使用jdbc连接Greenplum数据库和Postgresql数据库
1、公司使用的Greenplum和Postgresql,确实让我学到不少东西。简单将使用jdbc连接Greenplum和Postgresql数据库。由于使用maven仓库,不能下载Greenplum的jar包,但是可以下载Postgresql的jar包,所以Greenplum的jar包,自己可以百度自行下载。名字就叫做greenplum.jar。
maven依赖如下所示:
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql --> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils --> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.3</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections --> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> </dependency>
2、db.properties配置文件里面如下所示:
# 1.posgresql posgresql_driver=org.postgresql.Driver posgresql_url=jdbc:postgresql://192.168.xx.xx:5432/数据库名称(即schema) posgresql_user=