连接timesten 数据库,在Java下有两种方法:
第一种,使用 Drivermanager
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TTTest {
public static void main(String[] args) {
// create the TimesTen data source and set the connection URL
String URL = "jdbc:timesten:direct:dsn=my_ttdb;UID=oracle;PWD=oracle";
Connection conn = null;
try {
Class.forName("com.timesten.jdbc.TimesTenDriver");
} catch (ClassNotFoundException ex) {
// See "Handling errors"
}
try {
// Open a connection to TimesTen
conn = DriverManager.getConnection(URL);
System.out.println("success");
// create and execute the statement
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select count(*) from cmn_tn2lrn201");
// process the result set
while(rset.next()) {
System.out.println("Value: " + rset.getInt(1));
}
} catch(SQLException e) {
e.printStackTrace();
}
}
}
第二种 使用Datasource
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class TTTest {
public static void main(String[] args) {
TimesTenDataSource ds = new TimesTenDataSource();
ds.setUser(myttusername); // User name to log in to TimesTen.
ds.setPassword(myttpwd); // Password to log in to TimesTen.
ds.setUrl("jdbc:timesten:direct:<dsn>");
ds.setOraclePassword(myorapwd); // Password to log in to Oracle.
Connection conn = ds.getConnection();
// create and execute the statement
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select count(*) from cmn_tn2lrn201");
// process the result set
while(rset.next()) {
System.out.println("Value: " + rset.getInt(1));
}
} catch(SQLException e) {
e.printStackTrace();
}
}
}
分享到:
相关推荐
TimesTen学习笔记,主要对TimesTen数据源的配置、连接以及TimesTen与Oracle之间数据的交互。
NULL 博文链接:https://menglh.iteye.com/blog/299850
Oracle TimesTen 7.0 操作、管理和编程笔记
针对timesten 内存数据库环境的java开发手册,pdf格式
Timesten运维笔记[借鉴].pdf
Oracle Timesten 数据库 java 手册 官方手册
最近公司打算在下一代计费系统里面使用内存数据库的技术,所以作为公司的设计人员之一的我,在oracle网上下了个TimesTen,安装在我们的测试服务器上面aix5,这篇短文主要是我操作数据库的一个笔记,下一篇打算发一个...
使用java调用timesten实现Oracle入库 1、要安装好timesten 2、需要配好system dsn ttdemo 3、创建表和存储过程 以上略 4、java内容如下: package com; import java.sql.Connection; import ...
详细java连接timesten数据库入门实例文档,包括java连接timesten内存数据库所需的所有jar(包括各种版本)
java访问timesten数据库定义.pdf
安装文件:otn.oracle.com Linux: red-hat ES3, SUSE9 CPU:intel EM64
使用java连接timesten数据库是要用到的包
TimesTen for java 开发指导手册
Oracle TimesTen Java 开发人员和参考指南
附带ttjdbc1.6-1.8各种版本jar包,无法加载指定的驱动程序请更换对应jar包驱动
1、Timesten内存数据库jdbc各个版本驱动jar包, 2、java连接timesten数据库的demo 3、timesten数据库配置说明文档
最近用到Oracle TimesTen,网上找资料都是7.0的,现在最新的是11G,于是自己对照着英文QuickStart和手册写了一份在Linux下的安装和配置文档,记录了安装和使用过程中的一些要主意的地方。
为什么内存型数据库能够那么快,能够保证...我们来看看这组数据,看看内存型数据库 timesten到底有何绝招: timesten平均修改记录时间 30*百万分之一秒 timesten平均读取记录时间 10*百万分之一秒 比oracle快11到40倍
TimesTen最佳实践,全面介绍的TimesTen 的特性,编程接口
Oracle TimesTen Java Developer and Reference Guide