This article documents the steps necessary to enable SQL Server Distributed Management Objects (SQL-DMO) client side functionality without the need to install the SQL Server Client Utilities.
You write an application that takes advantage of the SQL-DMO object model in SQL Server. Your application runs fine on the server computer itself, and it runs fine on client computers when the SQL Server Client Utilities are installed. However, by itself, the application does not run. Additionally, you may see several errors related to this as well. The most common errors are:
ActiveX can't create object
Field is not bound correctly
Cannot find entry pointNOTE:
Installing Microsoft Data Access Components (MDAC) does not resolve the problem.
MDAC does not install the Sqldmo.dll file or any of the many dependent DLLs associated with the Sqldmo.dll file. What MDAC does include is many of the related DLLs that a SQL-DMO client connection uses. Regardless, bundling MDAC with your application installation is not going to be the most efficient answer either, because you do not need all of the MDAC DLLs to get your DMO connection to work. Also, MDAC installs many additional features that you will likely never use on your client computers. The main point here is that you do not need to install all of MDAC to get the functionality you want, just the necessary DLLs. The DLLs are covered later in this article.
Because different types of DLLs and where you need to place them are discussed, let's digress for a moment and briefly review Win32 and COM based DLLs. For the purposes of this article, all you need to know is how to tell them apart and then what to do with the DLLs once you identify them. With that in mind, here is what you need to know:
- You need to register COM based DLLs through the Regsvr32 utility.
- You need to place native Win32 DLLs in the application path.
- You may also place native Win32 DLLs into the Win32 directory.
Sometimes, it may be difficult to make a distinction between COM and non-COM based DLLs; however, generally a COM based DLL always has the following entry points:
To view the entry points, right-click the DLL, and then click Quick View
on the shortcut menu. The information that appears is noted in the "Export Table" section of the DLL information.
Following is the list of SQL-DMO related DLLs that you need to enable DMO from a client:
From the preceding list of DLLs, the Sqldmo.dll is the only one that you need to register on the client computer. However, in order to successfully register the Sqldmo.dll file, the Sqldmo.rll file must be present on the client computer in the following directory:
(server side location): c:\Mssql7\Binn\Resources\1033
(client side location): c:\Winnt\System32\Resources\1033
The Sqldmo.rll file always draws questions. An .rll file is a localized resource file. The resource directory varies based upon the national language configured on the SQL Server and client install. In this instance, directory 1033 is a decimal representation of the language identifier 0X0409, indicating U.S. English. After this .rll file is in place, you can register the Sqldmo.dll file by invoking the Regsvr32 utility. The command to register the file is:
Upon successful registration, you should receive a message that states:
DLLRegisterServer in SQLDMO.dll succeeded.
If you want to automate this registration into your application setup routine, refer to the various switches associated with the Regsvr32 utility. The command to register the file silently is:
c:\regsvr32 /s- sqldmo.dll
The directory that contains the Sqldmo.dll file must have a specific structure on the client computer; otherwise you may receive an error message similar to the following:
GetLastError returns 0x0000007e
This error means that error 126 (expressed in decimal), which corresponds to a "specified module not found" error, occurred. In this instance, this relates to the Sqldmo.rll file. That is, the Regsvr32 utility finds the Sqldmo.dll file, but cannot complete its registration unless the Sqldmo.rll file is also available in the expected 1033 subdirectory.
To avoid this, do the following:
- Add a directory called "Resources" to the location where the Sqldmo.dll resides.
- Add a subdirectory under Resources called "1033".
- In this directory, copy the Sqldmo.rll file.
When complete, the directory structure should look like:
Directory that contains Sqldmo.dll\Resources\1033
And that 1033 directory should contain the Sqldmo.rll file.
In addition to the DLLs mentioned previously, you also want to make sure that you have the proper netlibrary DLLs installed. The main netlibrary DLLs you need here are:
- Named Pipes: Dbnmpntw.dll
- Sockets: Dbmssocn.dll
- Multi-Protocol: Dbmsrpcn.dll
These are Win32 based DLLs, so you do not need to register these DLLs. Just place the DLLs into the System32 directory for Microsoft Windows NT or into the System directory for Microsoft Windows 95 or Windows 98.
After you complete the preceding steps, the client application should start without any of the initial problems caused by the absence of the necessary files.