代码如下每条记录POST 一次连本局域网内的ORACLE服务器进行入库
基本上两分钟就搞定了
但是要连接远程的数据库(在广州就很慢了至少要5小时才能完成,)
是光纤连过去的带宽肯定有
有什么办法在程序中或者是ORACLE的配置中优化一下吗??  while (i<edtbaodan.lines.Count) and   (copy(edtbaodan.lines[i],length(edtbaodan.lines[i])-9,10)='baodanhead') do
  begin
    try
    table1.close;
    table1.open;
    j:=0;
    table1.insert;
    str:=edtbaodan.Lines[i];
    while (j<table1.fieldcount-1)   do
    begin
      postion:=pos(',',str);
      if j=table1.fieldcount-2 then
      begin
        if postion<>1 then
          table1.fields[j].value :=copy(str,1,postion-1)
        else
          table1.fields[j].value:=null;
      end
      else
       if postion<>1 then
        table1.fields[j].value:=copy(str,1,postion-1)
      else
        table1.fields[j].value:=null;
      str:=copy(str,postion+1,(length(str)-postion));
      j:=j+1;
    end;//end while
    
    table1.post;
    i:=i+1;
    StatusBarmsg.Panels[0].text:='正在处理:';
    StatusBarmsg.Panels[1].text:='报单成绩,已处理'+inttostr(i)+'条记录,总共有'+inttostr(edtbaodan.lines.Count)+'条记录';
    Formsjzr.Refresh;
    except
      begin
      table1.Cancel;
      i:=i+1;
      continue;
      end;
    end;//end try
  end; //end while  i<edtbaodan.lines.Count

解决方案 »

  1.   

    你最好换TQuery组件试一试,加为你用的TTable每次都把所有的数据下载,这样子会由于网络的速度而影响你下载和更新数据的速度的
      

  2.   

    第一,采用TDatabase进行显式的连接,最好设置AliasName和DatabaseName不一样,然后Table控件的DatabaseName与TDatabase的DatabaseName的一样。在系统打开的时候进行TDatabase.Open;设置Table控件的CatchedUpdate为TRUE;不要在循环中频繁的打开和关闭数据库,对结果进行批量提交,Table.ApplyUpdates;
    如果网络速度有保障的话,应该不受地域的影响!
      

  3.   

    jouson(阿杰) 
    兄弟我
    用了你的办法
    速度是加快了很多
    但是一到Table.ApplyUpdates;
    就停下来了啊
    怎么回事情啊??