[GreenPlum] -> 使用JDBC连接GreenPlum数据库

2023-03-20 00:00:00 专区 订阅 连接 付费 下载

使用JDBC连接GreenPlum数据库
下载JDBC
方式一:官网下载
方式二:CSDN下载

IDEA添加Jar包


JDBC-Java连接
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class GreenPlum {
public static void main(String[] args) {
try{
Class.forName("com.pivotal.jdbc.GreenplumDriver");
Connection db = DriverManager.getConnection("jdbc:pivotal:greenplum://****:****:****:****:5432;DatabaseName=**", "gpadmin", "gpadmin");
Statement st = db.createStatement();
ResultSet rs = st.executeQuery("select id from test limit 10");
while (rs.next()) {
System.out.println(rs.getString(1));
}
rs.close();
st.close();
}catch (Exception e){
e.printStackTrace();
}

}
}


本文来源:https://blog.csdn.net/m0_51197424/article/details/122362454

相关文章