greenplum.jar 官方JDBC驱动
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[]) throws Exception{ Class.forName("com.pivotal.jdbc.GreenplumDriver"); Connection db = DriverManager.getConnection("jdbc:pivotal:greenplum://192.168.139.128:5432;DatabaseName=postgres", "gpadmin", "gpadmin"); Statement st = db.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM test01 limit 100"); wh ile (rs.next()) { System.out.println(rs.getString(1)); } rs.close(); st.close(); } }
用户评论
谢谢分享,试试先!