In this chapter, we start with the example projects for the SimpleDataSnapServer and DataSnapServer from the previous chapter. They can be found on the CD-ROM with this book.
The objective in this section is to make the connection not work just locally, but also remotely. In other words, DCOM instead of COM (when both the DataSnap Server and Client are running on the same machine).
When setting up DCOM, it is best to set up the server half of the DCOM program on a machine that's running as a Windows NT/2000/XP domain server. In particular, you don't want to run the DataSnap server on a Windows 95/98/Me machine, and it is best if the server machine is a domain server and the client machines are all part of this domain. If you don't have an NT/2000/XP domain server available, you probably should try to set up your client and server machines to have the same logon and the same password, at least during the initial stages of testing. Windows 98/Me ships with DCOM as part of the system, whereas Windows 95 machines need to have DCOM added to the system. You can download the DLLs necessary to implement DCOM on a Windows 95 machine from the Microsoft Web site (although Microsoft officially doesn't support Windows 95 anymore ”nor Windows NT for that matter).
You must have the DataSnap server registered on both the client and the server. The client program could still locate and launch the server if you failed to register it, but COM could not marshal data back and forth if the type library for the server is not registered on the client machine. You can do so by running the DataSnap server once on both machines. However, it's not very convenient to run the DataSnap server on all client machines, so an easier solution is running the DataSnap server once on the server, and then registering the TLB file on the clients using TRegSvr.exe (in the CBuilder6\Bin directory). In this case, the TLB file is called SimpleDataSnapServer.tlb . This file was generated automatically when you created the DataSnap server.
When you access the DataSnap server remotely from a client machine, you need to copy the single C++Builder client executable to the client side only. No database tools are needed, other than the MIDAS.DLL file, which contains the ClientDataSet functionality.
Top |