Page 1 of 1

improvvise Error on TMSConnectio.Connect

Posted: Tue 30 Oct 2007 18:10
by spzsoft
my application is installed on 5 client and use sqlserver2005 express.
without warning 2 of the 5 client raise error on connection while remaining 3 connect fine. I ave modified the code for write en error code but the application crashed whitout error message.
The portion of code is
try
Connection.Connect;
Result:=cnOctoRubrica.Connected;
except
on E: EMSError do
begin
try
if E.MSSQLErrorCode <= NE_MAX_NETERROR
then StrErrore:=format('SQL=[%d]%s ',[StrErroreSQL(E.MSSQLErrorCode),E.MSSQLErrorCode])
else StrErrore:='';
StrErrore:=StrErrore + format('OLEDB=[0x%s] ',[IntToHex(E.OLEDBErrorCode,8)]);
finally
StrErrore:=StrErrore+E.LastMessage;
LogFile.Scrivi(lgErr,StrErrore);
end;
end;
on E: Exception do ErroreLog(E.Message);
else begin
Result:=False; raise;
end;
end;
--------------------------------------
it seems that the crash is in conncet istruction, but I do not succeed to simulate the problem in my dev machine, it is only in the machine of the client.
In all 5 client is installed the sql native client.
you have some idea on like having at least an error code ?

Regard
B.S.

Posted: Wed 31 Oct 2007 13:52
by Antaeus
Try to check provider versions for different values of TMSConnection.Options.Provider. See the code below for example.
You should place TMSConnection, TButton, TMemo objects onto the form in the a new application to run this code.

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);

  procedure Test(ProvName: string);
  var
    ver: string;
  begin
    try
      ver := MSConnection1.ClientVersion;
    except
      ver := 'Cannot connect';
    end;
    Memo1.Lines.Add(ProvName + ':  ' + ver);
  end;

begin
  Memo1.Clear;
  MSConnection1.LoginPrompt := True;

  MSConnection1.Disconnect;
  MSConnection1.Options.Provider := prAuto;
  Test('prAuto');

  MSConnection1.LoginPrompt := False;

  MSConnection1.Disconnect;
  MSConnection1.Options.Provider := prSQL;
  Test('prSQL');

  MSConnection1.Disconnect;
  MSConnection1.Options.Provider := prNativeClient;
  Test('prNativeClient');
end;
What will be the result when you run an application based on this code on two clients having problems with connection?

Posted: Wed 31 Oct 2007 17:30
by spzsoft
I ave alrady tryed to change the data provider and i ave incresed the timeout connection with no resul , bat today i ave installed the SQL monitor on the client machine and these get the error
"SQL Network Interfaces Error Locating ServerInstance Specified [xFFFFFFFF]" jast before the program crash. I ave tried on the web and i find this page http://blogs.msdn.com/sql_protocols/arc ... 83684.aspx I ave followd the instruction of the point "message 6" and with this change on the sql server the applicatio go on.
But it remain to undstand becouse, without any warning and without any apparing change of configuration, application has stopped to work. The adpted solution is a workarround.
Regard
B.S.

Posted: Thu 01 Nov 2007 09:34
by Antaeus
Thank you for information. It is good to see that this problem has been solved.
We will investigate this issue. Probably there is a way to catch this error by SDAC and raise an exception.