用JDBC连接Vertica数据库的例子源代码
来源:互联网 发布:堺刀司 知乎 编辑:程序博客网 时间:2024/05/16 14:42
import java.sql.*;import java.util.Properties;public class VerySimpleVerticaJDBCExample { public static void main(String[] args) { /* JDBC 3.0 以前的版本需要添加下边这段代码 */ /* * try { Class.forName("com.vertica.jdbc.Driver"); } catch * (ClassNotFoundException e) { // Could not find the driver class. * Likely an issue // with finding the .jar file. * System.err.println("Could not find the JDBC driver class."); * e.printStackTrace(); return; // Bail out. We cannot do anything * further. } */ Properties myProp = new Properties(); myProp.put("user", "dbadmin"); myProp.put("password", "vertica"); myProp.put("loginTimeout", "35"); myProp.put("binaryBatchInsert", "true"); Connection conn; try { conn = DriverManager.getConnection( "jdbc:vertica://docd04.verticacorp.com:5433/dbname", myProp); System.out.println("Connected!"); conn.close(); } catch (SQLTransientConnectionException connException) { // There was a potentially temporary network error // Could automatically retry a number of times here, but // instead just report error and exit. System.out.print("Network connection issue: "); System.out.print(connException.getMessage()); System.out.println(" Try again later!"); return; } catch (SQLInvalidAuthorizationSpecException authException) { // Either the username or password was wrong System.out.print("Could not log into database: "); System.out.print(authException.getMessage()); System.out.println(" Check the login credentials and try again."); return; } catch (SQLException e) { // Catch-all for other exceptions e.printStackTrace(); } }}
0 0
- 用JDBC连接Vertica数据库的例子源代码
- 用JDBC连接Vertica数据库后插入一行数据的例子源代码(接上篇)
- 用jdbc连接数据库的例子
- JDBC连接数据库例子
- 一个JDBC连接数据库的例子
- JDBC连接数据库的例子(oracle)
- JDBC连接数据库的笔记和例子
- JDBC连接MySql数据库的简单例子
- oracle jdbc连接数据库的源代码分析之获取连接
- Orange Script 通过JDBC连接数据库的例子
- 使用jdbc连接ORACLE数据库进行查询的一个例子
- 举例策划JDBC连接数据库源代码
- 用jdbc操作数据库的简单例子
- JDBC连接SQL Server数据库例子
- JDBC连接MySQL数据库小例子
- 基于列的数据库vertica
- 基于列的数据库vertica
- jdbc数据库的连接
- bresenham画圆算法
- web.xml配置详解
- StringBuilder与StringBuffer的区别(转)
- 第十八篇 ANDROID的声音管理系统及服务
- 科研解决问题的过程
- 用JDBC连接Vertica数据库的例子源代码
- Hibernate Spatial处理空间数据
- iBatis中使用事务
- 二分查找,你真的掌握了吗?
- 《使用Python进行自然语言处理》学习笔记六
- LeetCode Best Time to Buy and Sell Stock
- sap bw dtp 过滤例程 实现了有key值的增量处理
- SensorSimulator安装教程与使用指南
- Linux set unset命令