jdbc 大批量更新 oracle数据库中的数据
我用的是PreparedStatement来发送提交,并且数据量非常庞大。
一次需要执行8900多条更新语句,也就是Update语句。
我试过分开,一部分一部分来执行提交,但还是一样的速度慢,而且越执行越慢。实在是没有什么好的办法了,请教各位高手。
8900多条更新,会慢,那就是写法有问题!
把SQL贴上来!
// 执行更新语句,将值插入到历史表中。
@SuppressWarnings("unchecked")
public void updateHistory(Map map, Measure measure) throws Exception {
String sql = " update history" + measure.getH_tableid() + " set field"
+ measure.getH_fieldid() + "=? where id =?";
System.out.println("map=" + map.size());
frame.getJTextArea1().append("map=" + map.size() + "\n");
frame.getInfoArea().append(sql + "\r\n");
PreparedStatement pstm = null;
int count = 0;
try {
conn.setAutoCommit(false);
pstm = conn.prepareStatement(sql);
Set set = map.entrySet();
Iterator it = set.iterator();
while (it.hasNext()) {
count++;
long sttime = System.currentTimeMillis();
Map.Entry entry = (Map.Entry) it.next();
List values = (List) entry.getValue();
for (int j = 1; j <= 12; j++) {
String value = StringUtil.valueTranser(values.get(j - 1)
+ "");
String id = DateUtil.calculateTime((Date)
相关问答:
<?php
getenv("ORACLE_HOME");
$conn=ocilogon("test","test","test_db");
if($conn)
echo success;
&nb ......
原句是这样的:
$sql = "SELECT * from `BadDut.user` WHERE `Account`='".strtolower($_POST["username"])."' ";
strtolower是php的一个函数,不区分大小写的 ......
Oracle :select grbh from com.eway.vo.Zjxx zj where to_char(zj.jbsj,'yyyymm')='"+ sj + "'
其中 sj是字符串参数 现在想把上面的SQL语句转换为Mysql的 主要是时间传入 ......
在Eclipse里编写的一个JAVA程序,连接数据库,却总连不上,程序为:
import java.sql.*;
public class as {
public static void main(String args[])throws Exception
{
Class.forName("oracle. ......