Serious issues with D2010, ADO and MS SQL 2005 database.

Hello,

I am running into some strange issues when trying to create simple db-based CHAT application.

I have a client-side service app with a thread like this:

constructor TInterOpMobileClientPingThread.Create(const UserName: AnsiString);
begin
  inherited Create(True);
  FreeOnTerminate := True;

  FUserName := UserName;
end;

destructor TInterOpMobileClientPingThread.Destroy;
begin
  Log('TInterOpMobileClientPingThread.Destroy');
  //FChannel.Free;
  //FMessage.Free;
  inherited Destroy
end;

procedure TInterOpMobileClientPingThread.Execute;
var
  vService: IInterOpChatService;
begin
  while not Terminated do
  begin
    Log('...in a thread...');
    try

      FMessage := TROBinMessage.Create;

      FChannel := TROSuperTCPChannel.Create(nil);
      FChannel.Encryption.EncryptionMethod := tetRijndael;
      FChannel.Encryption.EncryptionRecvKey := 'CF656EEC2FEF3C03732AA732E7388EEE';
      FChannel.Encryption.EncryptionSendKey := 'CF656EEC2FEF3C03732AA732E7388EEE';
      FChannel.Encryption.UseCompression := True;
      FChannel.Host := gApplicationSettings.ChatServerHost;
      FChannel.Port := gApplicationSettings.ChatServerPort;

      try
        vService := CoInterOpChatService.Create(FMessage, FChannel);
        vService.Ping(FUserName);
        Log('ping sent');
      finally
        FMessage.Free;
        FChannel.Free;
      end
    except
      on E: Exception do
        Log('Exception sending ping: ' + E.Message)
    end;

    Sleep(1000);
  end
end;

It uses RemObjects framework to invoke a method on server, which will update CHAT_USERS.LAST_PING field of the table.

This thread is being initiated/terminated in code like this:

procedure TdmSvcCHAT.Login;
var
  vIdx: Integer;
  vSL: TStringList;
  vMsg: AnsiString;
begin
  Log('TdmSvcCHAT.Login');
  try
    FUserName := '[' + FUserFullName + ']';

    FChatService.LoginUser(FUserName);

    Log('logged in');

    FPingThread := TInterOpMobileClientPingThread.Create(FUserName);
    FPingThread.Resume;

    Log('ping thread started.');

    CHATEventReceiver.RegisterEventHandlers([EID_ChatEvent], [Self]);
    FChatService.IsChatServiceReachable;
    CHATEventReceiver.Activate;

    FLoggedIn := True;
 except
    on E: Exception do
    begin
      if not (InStr(E.Message, 'Timeout') > 0) then
        Log('-ERR: TdmSvcCHAT.Login: ' + E.Message);
    end;
  end;
end;

procedure TdmSvcCHAT.Logout;
begin
  Log('TdmSvcCHAT.Logout');
  try
    FChatService.LogoutUser(FUserName);

    Log('User logged out on server');

    if Assigned(FPingThread) then
    begin
      FPingThread.Terminate;
      Log('ping thread terminated.');
    end
    else
      Log('THREAD DOES NOT EXISTS!!!!!');

    CHATEventReceiver.Deactivate;
    CHATEventReceiver.UnregisterEventHandlers([EID_ChatEvent]);

    FConnected := False;
    FLoggedIn := False;
    FWasLoggedIn := False;
    CHATChannel.Active := False;
  except
    on E: Exception do
      Log('-ERR:  TdmSvcCHAT.Logoff: ' + E.Message)
  end;
end;

When i login the first time, it works just fine, then i logout. Then i login again...After that at some point the thread terminates itself, without reaching Logout.

I see "THREAD DOES NOT EXISTS" in the log file.

I know this probably does not relate to ADO probably or MS SQL, sorry for the subject line...But we'll probably get there further down the road :).

thanks.
0
Eugene
4/2/2014 5:58:50 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

0 Replies
502 Views

Similar Articles

[PageSpeed] 59

Reply:

Similar Artilces:

How to create SQL Mobile 2005 database from a MS SQL 2005 database?
Hi guys,I'm trying to find solutions to help me in creating a SQL Mobile 2005 database from a SQL 2005 database, with the same table structure and data.May I know how can I achieve this?Thanks.Regards,Jenson Hi Jenson, Visual Studio 2005 or SQL Server 2005 is able to open SQL Mobile 2005 database. However you need either SQL or .NET code to convert SQL Mobile 2005 database this way. Here is an example from MSDN forums which is to convert to xls instead: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=78640&SiteID=1Zhao Ji MaSincerely,Microsoft Online Community Suppo...

Connecting to MS-SQL-Express with ADO and Delphi 6
Hi, I have installed MS-SQL Express and created a database - Test1 - and a table within that database called Equipment with a few columns. I have created a new delphi 6 application with a TADOConnection component. When creating the connection string I have chosen the "Microsoft OLE DB Provider for SQL Server", then entered the server name as "mtpcname\SQLExpress1" and selected Windows NT Integrated security. Clicking the Test Connection button says that the connection was successful. However the drop down list to select the database on the server only list ...

Field datatype for Blob with ADO and MS SQL 2005
Hello I need to store a structured datatype (TRecord) in a blob field in the sql database, in paradox I used datatype (binary) - what field datatype should be used with ms sql? regards Henrik > {quote:title=Henrik Nedergaard wrote:}{quote} > Hello > > I need to store a structured datatype (TRecord) in a blob field in the sql database, in paradox I used datatype (binary) - what field datatype should be used with ms sql? > > regards > Henrik varbinary(max) /Micke ...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

[Delphi 2010] ADO - MS SQL Server 2000 - Tranasction
Hello! For the first time I try to use Transaction when connecting via ADO to an MS SQL 2000 Server. I open the Connection, I open the ADOTable, I start the transaction, I insert some records to the ADOTable, I committ the transaction and ... nothing is saved in the SQL Server. Any hints what I'm missing? Thanks in advance and regards, Klaus "Klaus Edelmann" <fritzfranz24@hotmail.com> ha scritto nel messaggio news:246769@forums.embarcadero.com... > Hello! > > For the first time I try to use Transaction when connecting via ADO to an > ...

Move a Table from one SQL 2005 Database to Another SQL 2005 Database
I created a table in an SQL 2005 database, however, I want to move that table and the data to another SQL 2005 database (within the same server). I am new to SQL 2005 and detailed instructions would be greatly appreciated. Thanks Bill You have two options the first is clean but the second is easier.  Try the links below for details.  Hope this helps. http://msdn2.microsoft.com/en-us/library/ms174335.aspx http://msdn2.microsoft.com/en-us/library/ms188029.aspx  Kind regards,Gift Peddie Thanks, but the documentations is somewhat overwhelming and was hoping of a ba...

Migrating sql server 2005 express database to sql server 2005 database
Hi, I have an application developed using VWD and sqlserver express database. The express database is turning out to be small in size and we need to migrate to larger sqlserver 2005 database. What are the steps for this migration, please list in detail. Regards, Sandyhttp://www.thequinn.infohttp://www.sksdataservices.comhttp://www.infobasket.info Hi Sandy, To move a database from SQL Express to SQL 2005, you can use the following steps. 1. If your database file is attached to the server instance, you will need to detach it first using SQL management studio. If it is under App_Data folde...

How to Upgrade MS-SQL 2005 Express Edition To MS-SQL 2005 Developers Edition
Hey, i am using VS2008 for development. I have already installed MS-SQL2005 Express Edition on my machine. I would like to upgrade it to Developer Edition. I have a few databases in Express Edition which i want to migrate to developer edition. So i was thinking if anyone could help me with upgrading my express edition to developer edition. I would highly appreciate it. ThanksJeff The simplest way is to just back your database(s) up, then restore them onto the Developer Edition instance of SQL Server....

RoleManager
Hi, Happy new year to all!! How to use MS-ACCESS database instead of MS-SQL2005 as Rolemanager provider . What are the privileges required for App_Data folder, if I use MS-Access as Rolemanager provider.   Thanks in advance.    ...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

Delphi, ADO, SQL Anywhere
This combination seem not to work together. I'm using D5 Enterprise, ASA 6.03 w/latest EBF On some tables it works. But most of the tables produce a message "An Error occured". As soon as data bound contols are used, the connection just gives errors. It seem to work fine, if I use client based cursors. But this option copys the server table to the local client. This is not acceptable for my large tables. It lasts several minutes on my pc. Are there plans to release a native OLE DB provider for ASA or at least to fix the ODBC driver so, that ADO can be used? I am very...

Any compatibility issues between SQL 2005 Express and SQL 2005 Server
Hi All, The IP company that host my site is installing SQL 2005 soon and I my building a web application with SQL 2005 Express. So the question is has anyone heard of any problems with uploading an 2005 express onto a sql 2005 server? I would like to find out now before I finish all of the work. Don't want to find out later that you can't run a sql 2005 express database on a sql 2005 server. Thanks for taking the time to read this.   Well it seem no one know the answer so I emailed the author of a book called Beginning SQL Server 2005 Express. He emailed me back SQL Server 2005...

Web resources about - Serious issues with D2010, ADO and MS SQL 2005 database. - embarcadero.delphi.ado

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

ERISA and All Claim databases
... laws, on the books in 18 states, requiring self-insured employers to report data about the prices they pay to β€œall payer claims databases.” ...

Five million customers affected by Vtech database hack
Toy and educational material seller Vtech has revealed five million customers were affected by a hack of its app database and has also suspended ...


Old database dump from Nexus Mods circulating in criminal circles: Change password
Nexus Mods, a gaming site which has mods for 216 games , warned users about a β€œ potential database breach ” after a Reddit user was alerted by ...

Change your passwords: NexusMods suffers database breach
... security breach by posts on reddit. Cybersecurity firm REN-ISAC had apparently contacted several university IT departments about a database ...

EFF confirms that the DEA has deleted its phone call database
Earlier this year, it was revealed that the NSA's massive surveillance program had a precursor: the Drug Enforcement Administration's USTO, which ...

VTech Admits Lack of Database Security Opened Door to Hack
A SQL injection, a common software flaw, was found to be the root cause in the VTech breach.

Animal Venom Database Could Be Boon To Drug Development
A new public database that catalogs animal toxins could spur the development of new drugs made with compounds found in animal venom.

Resources last updated: 12/19/2015 2:06:15 PM