【发布时间】:2013-06-30 21:23:10
【问题描述】:
我想用 jdbc 向 TERADATA 插入数据,但是速度很慢。我怎样才能让它更快?
我写了这段代码:
connection_tera= DriverManager.getConnection
(
"jdbc:teradata://192.168.x.xx/database=DBC,tmode=ANSI,charset=UTF8","dbc","dbc"
);
stmt_tera = connection_tera.prepareStatement("insert into a.b values(?)");
//some code here to start while loop
stmt_tera.setObject(i,reset.getobject(i));
stmt_tera.addBatch();
if(addedBatchNumber%100==0)
stmt_tera.executeBatch();
connection_tera.commit();
stmt_tera.clearBatch();
//some code here and finish while loop
我应该将 TYPE=FASTLOAD 之类的参数添加到连接字符串吗?还是别的什么?
【问题讨论】:
-
批量操作通常在数据库系统中配置,但禁用目标表的索引可能会有所帮助
标签: java performance jdbc prepared-statement teradata