Java连接GreenPlum
1.postgres驱动
下载:https://jdbc.postgresql.org/download.html
我下载的是:postgresql-42.2.4.jar
// URL
String url = "jdbc:postgresql://host:8006/lcc_gp";
// 数据库用户名
String username = "用户名";
// 数据库密码
String password = "密码";
Class.forName("org.postgresql.Driver");
// 获取连接
Connection conn = DriverManager.getConnection(url, username, password);
String sqlssss = "select * from pg_proc where proname='prc_test';";
PreparedStatement pre = conn.prepareStatement(sqlssss);
ResultSet rs = pre.executeQuery();
while(rs.next()){
System.out.println("===============》"+rs.getString(1));
}
本文来源:https://blog.csdn.net/qq_21383435/article/details/81983847
相关文章