要安装好timesten
需要配好system dsn ttdemo
创建表和存储过程
以上略
java内容如下
package com;
import javasqlConnection;
import javasqlPreparedStatement;
import javasqlDriverManager;
import javasqlResultSet;
import javasqlStatement;
import javaxsqlrowset*;
import comsunrowsetCachedRowSetImpl;
import comtimestenjdbcTimesTenDataSource;
public class Test {
public static void main(String arg[]) {
try {
//ClassforName(oraclejdbcdriverOracleDriver);
ClassforName(comtimestenjdbcTimesTenDriver);
String url = jdbc:timesten:direct:dsn=ttdemo;uid=logstat;pwd=logstat;ORACLEID=logstat_;OraclePWD=logstat;
TimesTenDataSource ds = new TimesTenDataSource();
dssetUrl(url);
Connection con = dsgetConnection();
consetAutoCommit(false);
PreparedStatement pstmt = null;
String sql = {call p_insert(??)};
pstmt = conprepareCall(sql);
pstmtsetInt();
pstmtsetString( Test timesten using procerure!);
pstmtexecuteUpdate();
mit();
consetAutoCommit(true);
conclose();
} catch (Exception e) {
Systemoutprintln(etoString());
}
}
}
备注在使用timesten实现文章提到的批量入库就会出现错误
javalangClassCastException: comtimestenjdbcJdbcOdbcConnection
at oraclesqlArrayDescriptorcreateDescriptor(ArrayDescriptorjava:)
at oraclesqlArrayDescriptorcreateDescriptor(ArrayDescriptorjava:)
at comTestmain(Testjava:)
由于java水平太差不好解决记录于此