Recent

Author Topic: EMSSQLDatabaseError: Error 20002  (Read 2983 times)

aad1234

  • Newbie
  • Posts: 2
EMSSQLDatabaseError: Error 20002
« on: May 07, 2019, 08:21:54 am »
Greetings, everyone.

I am relatively new to Lazarus, and I am currently developing a desktop application in Windows 10 using Lazarus v1.8.4. I have finished most parts of the application, including SQL Server database-related modules, using the adequate information and help included in the forum and wiki, as well as the great components and libraries Lazarus has. However, one day, as I was testing my application, I encountered an exception stating the following message:

Project [Project Name] raised exception class 'EMSSQLDatabaseError' with message:
DBConnection: Error 20002:
Adaptive Server connection timed out (IP)
Adaptive Server connection failed (IP)


Upon further testing, it was determined that the error occurs whenever the application attempts to connect to the database as follows:

Code: Pascal  [Select][+][-]
  1. DBConnection.Connected := True;


Prior to this, I believe no code was altered and every module performs as expected.

How do I resolve this issue?

Thank you very much.

nouzi

  • Sr. Member
  • ****
  • Posts: 322
Re: EMSSQLDatabaseError: Error 20002
« Reply #1 on: May 07, 2019, 09:34:08 am »
you can try this code
Code: Pascal  [Select][+][-]
  1.  
  2. try
  3. .....
  4.    DBConnection.Connected := True;
  5. .....
  6. Except  
  7.    on E:Exception   do    //EDatabaseError
  8.    
  9.           ShowMessage('can not connection server ' + #13#10 + E.Message)   ;
  10.  
  11.   else
  12.          ShowMessage('err unknown' );
  13.  
  14.  
  15. end;
  16.    
  17.  
  18.  
  19.  
« Last Edit: May 07, 2019, 09:40:57 am by nouzi »
My English is  bad
Lazarus last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

Zvoni

  • Hero Member
  • *****
  • Posts: 3226
Re: EMSSQLDatabaseError: Error 20002
« Reply #2 on: May 07, 2019, 10:58:02 am »
Is the MS SQL-Server remote or localhost?

EDIT: Everything i found points to wrong Version of FreeTDS
« Last Edit: May 07, 2019, 11:02:54 am by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

aad1234

  • Newbie
  • Posts: 2
Re: EMSSQLDatabaseError: Error 20002
« Reply #3 on: May 07, 2019, 12:08:19 pm »
Thank you for your response. I've tried nouzi's solution, to no avail. :(

The MS SQL-Server is remote.

The wrong version of FreeTDS is also something I'm considering. Might I have some further guidance on this?

Thank you very much!

Zvoni

  • Hero Member
  • *****
  • Posts: 3226
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018