作者:
1、要安装好timesten
2、需要配好system dsn ttdemo
3、创建表和存储过程
以上略
4、java内容如下:
package com;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.sql.rowset.*;
import com.sun.rowset.CachedRowSetImpl;
import com.timesten.jdbc.TimesTenDataSource;
public class Test {
public static void main(String arg[]) {
try {
//Class.forName("oracle.jdbc.driver.OracleDriver");
Class.forName("com.timesten.jdbc.TimesTenDriver");
String url = "jdbc:timesten:direct:dsn=ttdemo;uid=logstat;pwd=logstat;ORACLEID=logstat_214;OraclePWD=logstat";
TimesTenDataSource ds = new TimesTenDataSource();
ds.setUrl(url);
Connection con = ds.getConnection();
con.setAutoCommit(false);
PreparedStatement pstmt = null;
String sql = "{call p_insert(?,?)}";
pstmt = con.prepareCall(sql);
pstmt.setInt(1,1);
pstmt.setString(2, "Test timesten using procerure!");
pstmt.executeUpdate();
con.commit();
con.setAutoCommit(true);
con.close();
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
java.lang.ClassCastException: com.timesten.jdbc.JdbcOdbcConnection
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:148)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:114)
at com.Test4.main(Test4.java:38)
由于java水平太差,不好解决记录于此。
阅读(2654) | 评论(0) | 转发(0) |