测试greeplum数据库连接

import java.lang.*;
import java.sql.*;


public class test {
public static void main(String[] args)
throws Exception
{
String driver = "org.postgresql.Driver";
//String url = "jdbc:postgresql://:5432/";
String url = "jdbc:postgresql://:5432/";
String user = "";
String passwd = "";


Class.forName(driver);
Connection conn = DriverManager.getConnection(url, user, passwd);


PreparedStatement preStmt = conn.prepareStatement("SELECT id, name FROM test_name");

ResultSet rs = preStmt.executeQuery();

while(rs.next()){
System.out.println(rs.getString("id"));
System.out.println(rs.getString("name"));
}





}
}

你可能感兴趣的:(测试greeplum数据库连接)