jdbc连接Gbase
package com.jdbclearn.gbase8a.dataload;
import java.sql.*;
public class TestConnection {
public static void main(String args[]) {
try {
String url = "jdbc:gbase://192.168.1.1:8521/testdb";
String user = "test";
String passwd = "test123";
Connection connect = DriverManager.getConnection(url, user, passwd);
// 连接URL为 jdbc:gbase//服务器地址/数据库名 ,后面的2个参数分别是登 陆用户名和密码
//testdb 数据库实例
System.out.println("Success connect Gbase 8a server!");
Statement stmt = connect.createStatement();
ResultSet rs = stmt.executeQuery("select * from test");
// user 为你表的名称
while (rs.next()) {
System.out.println(rs.getString("name"));
}
} catch (Exception e) {
System.out.print("get data error!");
e.printStackTrace();
}
}
}
分享标题:jdbc连接Gbase
文章分享:http://pwwzsj.com/article/gsepcj.html