socketconncetion+midas组的三层,开始时速度不慢.不知怎的,现在要这么久.
设断点发现,程序运行到socketcon.Connected := true;时,就是这里,要30秒才过.procedure Tsysdb.DataModuleCreate(Sender: TObject);
var INISVN:Tinifile;
begin
     INISVN:=Tinifile.Create(CON_CNININAME);
     with INISVN do                                       
     begin
       PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
       if pubV_address='' then//新用户
       begin
             frm_remoteconfig:=Tfrm_remoteconfig.Create(application);
             frm_remoteconfig.ShowModal;
             frm_remoteconfig.Release;
       end;
         PubV_address :=INISVN.ReadString(CON_INTMBLOCK,'远程服务器ip','');
         free;
     end;
   socketcon.Connected:=false;
   socketcon.Address :=PubV_address;
   socketcon.ServerName:='MnfAppserver.MnfFind';
  TRY
    socketcon.Connected := true;//就是这里,要等待30秒才过
    Disp_MnfFind:=IMnfFindDisp(IDispatch(socketcon.AppServer));
  EXCEPT
    application.MessageBox(CON_REMOTCONEER,CON_PROMPT,MB_OK+MB_ICONINFORMATION);
    halt(0);
  END;
end;

解决方案 »

  1.   

    最关键的代码没贴上来
    你的Remote Data Module是怎样构建的?
      

  2.   

    procedure TMnfFind.RemoteDataModuleCreate(Sender: TObject);
    var
      ConStr,CurComputer:string;
      sysDName:string;
      sysSName:string;
      FileIni:TIniFile;
    begin
      CurComputer :=PriP_GetComputerName;
      FileIni:=TIniFile.Create(CONFILE);
      With FileIni do
      begin
        sysDName:=ReadString(DBLOCK,DBASENAME,'Stock');
        sysSName:=ReadString(DBLOCK,SERVERNAME,CurComputer);
        ConStr  :=ReadString(DBLOCK,CONNECTSTR,'');
        if not SectionExists(DBLOCK) then
        begin
          writestring(DBLOCK,DBASENAME,sysDName);
          writestring(DBLOCK,SERVERNAME,sysSName);
        end;
        free;
      End;
      if Trim(ConStr)='' then
      ConStr:=' Provider=SQLOLEDB.1;password=ibm20020706;Persist Security Info=False;User ID=sa;Initial '
              +'Catalog='+sysDName+';Data Source='+sysSName
              +';Connect Timeout=15;Use Procedure for Prepare=1;'
              +'Auto Translate=True;Packet Size=4096';
      Adocon.connected:=False;
      Adocon.ConnectionString :=ConStr;
      try
        Adocon.Connected :=True;
      except
        application.MessageBox('数据库连接出错,请核查数据库是否正常运行!','提示信息',MB_OK+MB_ICONSTOP);
        Halt(0);
      end;
    end;
      

  3.   

    有没有override构造函数?另外在服务器端是不应该出现MessageBox的,应该改为
    try
    Adocon.Connected :=True;
    except
      on e:exception do
         begin
           raise exception.create('数据库连接出错,请核查数据库是否正常运行!'+#13+e.message);
         end;
    end;
      

  4.   

    建个udl文件,看能不能正常连接上数据库
      

  5.   

    同意楼上的,先用udl测试一下连接。。
      

  6.   

    我原来用ado连接Oracle有这个问题,使用Oracle自己的驱动
      

  7.   

    楼主的这段代码看不出问题.楼上的,Oracle不能用ADO连接的,要出很多问题,我用BDE就没有问题的.