DataSnap Server - Use of CoInitializeEx / CoUninitialize for using COM

Hi,

I have an XE2 DataSnap server (Windows service) which uses ADO to query a MS SQL database to return results to clients.  As ADO is COM based, it requires the CoInitializeEx and CoUninitialize commands around any ADO statements.  My DataSnap server is working fine, other than the fact that when I stop the service, I always get an 'Application Error' message in the Event Log, along with an 'APPCRASH' information message.  I'm sure this is related to the CoInit..  commands.  I have none-DataSnap Windows serv
ice apps that use ADO and stop fine with no errors.

I've tried placing the CoInit/CoUninit commands in various places such as ServiceStart/ServiceStop, DSServerClass.OnCreate/DSServerClass.OnDestroy, and at the top/bottom of each server method function, but the crash still occurs when the service is stopped.

Can anybody show me where CoInit/CoUninit should be placed for multi-threaded DataSnap services?

Thanks,
Jonathan
0
Jonathan
11/19/2012 4:18:10 PM
embarcadero.datasnap 643 articles. 1 followers. Follow

1 Replies
1685 Views

Similar Articles

[PageSpeed] 36

Am 19.11.2012 17:18, schrieb Jonathan Wareham:
> Can anybody show me where CoInit/CoUninit should be placed for multi-threaded DataSnap services?

DataSnap is based on the Indy components and they do the 
CoInitialize/CoUninitilize for you.


-- 
Uwe Raabe
Embarcadero MVP
Certified Delphi Master Developer
Uwe's Blog: The Art of Delphi Programming <http://www.uweraabe.de/>
0
Uwe
11/19/2012 8:45:40 PM
Reply:

Similar Artilces:

Datasnap Rest client and no datasnap server
Hi, it's possible to use a delphi datasnap rest client to consume a rest web services written in other lenguages (like java or php) or i have to use an idhttp (or other) component? Thanks. Bye Pasquale Di Giovanni wrote: > > it's possible to use a delphi datasnap rest client to consume a rest > web services written in other lenguages (like java or php) or i have > to use an idhttp (or other) component? You could in theory, but it may be more trouble than its worth. You'd probably have to have control of the REST server so you can implement all the...

DataSnap REST Server as ISAPI calling a COM Object/Server -> access denied
Hello, I have an DataSnap REST Server published on an IIS webserver as ISAPI. The REST Server calls a COM Server. If I create a normale VCL test client which calls the COM Server it will work. If I call the COM Server from the ISAPI I get the error "access denied". I think it is not a problem of Delphi DataSnap. It should be a problem of IIS user permissions. Did someone know how to setup IIS user permissions to work? Note: If I add the AppPoolUser to the admin group it will work. But it is not a good idea :-) regards M. Pannier ...

XE Datasnap Client expection with a XE2 DataSnap Server.
I have developed a simple DataSnap Server on XE2 and the client that connects to this server is under XE. Everything works just fine except when freeing the ClientProxy Module on the client side I get the following exception " TDXError with message Invalid Ordinal 3." followed by a AV. Any hints how to avoid this exception or the Server must be on XE also? Thanks in Advance, Omar Zelaya I have now the DataSanp Server on XE and the client no longer throws the exception. So the question now is, it is possible to use a XE DataSnap Client with a XE2 DataSnap Se...

Connect Old Datasnap Clients with new datasnap Server ? [Edit]
Is it possible to connect a XE5 datasnap server with Borland C++ 6 Datasnap clients ? I want to know this before starting ... Edited by: Bart vd Voort vd Kleij on Jan 9, 2014 11:49 PM Edited by: Bart vd Voort vd Kleij on Jan 9, 2014 11:51 PM ...

Reconnect to DataSnap server or MySQL server
I'm trying to make a DataSnap server/client system. Apart from a lot of other problems the most troublesome problem right now is that I am unable to reconnect a TSQLConnection after it has failed. I have several TSQLConnections: * Client -> DataSnap Server * DataSnap Server -> Other DataSnap server * DataSnap Server -> MySQL Database All these connections will sometimes die. For example if the internet connection goes down or if one of the servers (MySQL/DataSnap) is restarted. When this happens I will get an Exception and the current SQL query or server method fails....

DataSnap XE2 , is this bug in datasnap ?
Hello I create small datasnap server , the lifecycle=session , the problem is : Create client and put tow sqlconnection in form or datamodule , and connect to that server , when made call , the methods in servermethods (may or may not) one of the servermethod class is destroy , many ways to call methods in both connections but the class is destryed in server. I trace and debug every thing possible but nothing wrong . I test these on xp ( sometimes problem is on ) I test on win7 same as above I test on Server2003 , the same I test on server 2008 , the same I test it as Delphi im...

DataSnap
Hello, All There Datasnap server designed to Delphi XE5 . Using protocol TCP. Port 211. The thread pool is set to 20. Life cycle = Session . The server has one standard method Echostring . Create a client. on the client server method is called Echostring in the number of 100,000 requests using the thread pool. Each thread is dynamically created object TSqlConnection. In various situations, the server can not just accept requests from the client ( it can handle 20,000 or more queries in the log server and the client there are no errors ) . Is unloaded from the memory of the client and run ...

DataSnap
DataSnap is advertised for c++ 2010, but does anyone know if it is actually supposed to work in 2010? The reason I ask is I can't get a datasnap server to work at all. I have succeeded in getting a client to work but the client proxy generator generates buggy code that requires manual changes before it will work. Any insight from CodeGear? or anyone else? In article <156892@forums.codegear.com>, Er No <eric@nospam.rcs100.fixthis.com> wrote: > DataSnap is advertised for c++ 2010, but does anyone know if > it is actually supposed to work in 2010? >...

DataSnap
Is possible send an array like parameter through a function in Datasnap ? > {quote:title=Hector Gomez wrote:}{quote} > Is possible send an array like parameter through a function in Datasnap ? There is a special Forum for datasnap: https://forums.embarcadero.com/forum.jspa?forumID=325 You have to be more specific how you use datasnap. If you use a webbroker datasnap server (using HTML pages to communicate with the datasnap) you can add an array in javascript and submit it to the datasnap server. On the datasnap server function you can analyse the array. {code} //Client...

DataSnap
Helllo, I begin development with DataSnap. I want to know if it is possible that datasnap creates a process by client. best regards, ...

Datasnap
Hello, I'm studying the datasnap environment and I have a dought: On the main class of the datasnap server, I have declared a public property of another object, and I want to access this object on datasnap client: TServerClass = class(TDSServerModule) private FUser: TUser; public property User: TUser read FUser; end; Thanks. Francisco Luiz Zanini Desenvolvedor +55 11 4226-3686 Hi! > TServerClass = class(TDSServerModule) > private > FUser: TUser; > public > property User: TUser read FUser; > end; You can only access suppor...

DataSnap : client switches from dead server to alive server
I am very new of this thing: DataSnap , client-server application. I need solution about 2 servers. When one of them crashes, client just gets error message and user simply changes to another server, such as type 'server name'. First, I use 'LoadParamsFromIniFile' every time I start to connect, but it does not work. Anyone can show me some lines of code to solve my problem or some suggestions? PS. I am using XE3 with embedded component. Thank you Hi there, I just got an answer by doing this:- declare.... private { Private declarations } ...

DataSnap Server with multiple : TDSServerClass / server
Hi, we are in the process of migrating an old midas/com server project to the new DataSnap orientation. Trying to not confuse things (as they are so different approaches), we've started a server project from scratch, and then move some of the business logic (all that apply) to the new server. The main goal is to split the server logic into various server-modules, according to functionality... So: - all that has to do with banking accounts would lay in a module - anything involving sales would be in a separated module - employees and payroll (guess) another module... an...

Server service name of Datasnap server in registry might be not what you wanted.
If you follow standard examples and don't rename the default tServer name to something unique, you might get unexpected problems :-) Since the name of the service (tServer), is what is used for identifying the service in registry, you cannot make more than one service using that default name. It must be renamed to something unique, and if service is to be deployed, you have to really think about the naming so it won't crash with other services. -- Delphi programmer at Dep.of Nutrition research, Faculty of Medicine, University of Oslo, Norway ...

Where is Datasnap?
I've recently bought Delphi XE and installed it. Having followed some of the Datasnap examples on youtube it looked like a good solution to a specific development project. However as soon as I go to File | New | Other | Delphi Projects there is a limited list of projects, none of them being Datasnap Server. Have I bought a version that doesn't have this? I think it's professional. Do I need to pay more money? Would be really great if this was spelled out somewhere. Anyone any idea what I need to do to get a Datasnap Server or how much I have to pay more? Or any other solutions? ...

Web resources about - DataSnap Server - Use of CoInitializeEx / CoUninitialize for using COM - embarcadero.datasnap

The stdafx.h model file Untitled Page
Codewiz51, the web site and blog of Gene Harris

Microsoft/DirectXTK · GitHub
The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Designing Remotable Interfaces (COM)
With the advent of the distributed component object model, it is important that your custom interface be remotable, even if you intend to use ...

Antivirus scan for 870f6bed7d213db42c6551d0e80ff08b at 2013-11-29 09:26:23 UTC - VirusTotal
× Cookies are disabled! This site requires cookies to be enabled to work properly Community Statistics Documentation FAQ About Join our community ...

GetDisplayAutoRotationPreferences function (Windows)
// make sure to initialize COM firstHRESULT hr = CoInitializeEx(NULL, 0);// retrieve the factoryMicrosoft::WRL::ComPtr spSimpleOrientationSensorStatics;hr ...

Antivirus scan for d29af877825fbbabcec427bc3d517ffbcfe78185f7c0028aa4a34bd660016f7f at 2014-12-17 17:31:35 ...
× Cookies are disabled! This site requires cookies to be enabled to work properly Community Statistics Documentation FAQ About Join our community ...

Antivirus scan for d29af877825fbbabcec427bc3d517ffbcfe78185f7c0028aa4a34bd660016f7f at 2014-12-17 17:31:35 ...
× Cookies er deaktiveret! Denne side kræver cookies for at fungere korrekt Fællesskab Statistik Dokumentation OSS Om Tilmeld dig vores fælleskab ...

Resources last updated: 12/20/2015 1:26:07 PM