greenplum-jdbc-5.1.4.jar
package com; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class TestJDBC { private Connection con ; private String user = "gpadmin" ; private String password = "123456" ; private String className = "com.pivotal.jdbc.GreenplumDriver " ; private String url = "jdbc:pivotal:greenplum://172.20.4.161:5432;DatabaseName=testDB" ; public static void main(String[] args) { // TODO Auto-generated method stub TestJDBC c = new TestJDBC(); c.Connect(); c.getCon(); c.closed(); } public void Connect() { try { Class. forName(className); System. out.println("加载数据库驱动成功!" ); } catch (ClassNotFoundException e ) { System. out.println("加载数据库驱动失败!" ); e.printStackTrace(); } } /** 创建数据库连接 */ public Connection getCon() { try { con = DriverManager. getConnection(url, user, password); System. out.println("创建数据库连接成功!" ); } catch (SQLException e ) { System. out.print(con ); System. out.println("创建数据库连接失败!" ); con = null; e.printStackTrace(); } return con ; } public void closed() { try { if (con != null) { con.close(); } } catch (SQLException e ) { System. out.println("关闭con对象失败!" ); e.printStackTrace(); } } }资源下载地址和密码(百度云盘):**** Hidden Message ***** 百度网盘信息回帖可见
本资源由Java自学网收集整理【www.javazx.com】 不容易 终于在这里找到了 可以下载 找了好久了 学编程 就这儿了 66666,很棒 要赶紧学习了,走起 多学习一下多学习一下多学习一下 这么多好资源 可以下载