设为首页 加入收藏

TOP

C++完成Oracle存储过程批量插入(一)(二)
2015-07-20 17:46:11 来源: 作者: 【 】 浏览:7
Tags:完成 Oracle 存储 过程 批量 插入
) { _struct = new MutableStruct(new Object[_sqlType.length], _sqlType, _factory); } public Datum toDatum(Connection conn) throws SQLException { _struct.setAttribute(0, this.id); _struct.setAttribute(1, this.name); _struct.setAttribute(1, this.code); return _struct.toDatum(conn, _ORACLE_TYPE_NAME); } public PocoTestModel(String id,String name, String code) { this(); this.id = id; this.name = name; this.code = code; } .... } Connection con = null; CallableStatement cstmt = null; try { con = OracleConnection.getConn(); System.out.println(new Date()); List orderList = new ArrayList (); for(int i=0;i<100000;i++){ orderList.add(new PocoTestModel(UUID.randomUUID().toString(),"name"+i,"code"+i)); } ArrayDescriptor tabDesc = ArrayDescriptor.createDescriptor("poco_test_object_arr_type", con); ARRAY vArray = new ARRAY(tabDesc, con, orderList.toArray()); cstmt = con.prepareCall("{call poco_test_arr_pro(?)}"); cstmt.setArray(1, vArray); cstmt.execute(); con.commit(); }catch ...
上面是所查到的Oracle批量插入的资料,关于C++方面,没有找到像JDBC类似的方法,提供数组类型的参数的存储过程的调用。下篇文章将介绍另外一个方案,来完成Oracle数据的批量插入。





首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇poj 1200 (hash) 下一篇UICollectionView自定义Layout之..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·MySQL 安装及连接-腾 (2025-12-25 06:20:28)
·MySQL的下载、安装、 (2025-12-25 06:20:26)
·MySQL 中文网:探索 (2025-12-25 06:20:23)
·Shell脚本:Linux Sh (2025-12-25 05:50:11)
·VMware虚拟机安装Lin (2025-12-25 05:50:08)