Create a unique OLE DB provider that you can deploy with your application by generating a unique set of GUIDs, naming the provider, and choosing unique DLL names.
Prerequisites
There are no prerequisites for this task.
Copy the following into a text editor and save it as a .reg file:
REGEDIT4 ; Special registry entries for a private OLE DB provider. [HKEY_CLASSES_ROOT\myoledb16] @="Custom SQL Anywhere OLE DB Provider 16.0" [HKEY_CLASSES_ROOT\myoledb16\Clsid] @="{GUID1}" ; Data1 of the following GUID must be 3 greater than the ; previous, for example, 41dfe9f3 + 3 => 41dfe9ee. [HKEY_CLASSES_ROOT\myoledba16] @="Custom SQL Anywhere OLE DB Provider 16.0" [HKEY_CLASSES_ROOT\myoledba16\Clsid] @="{GUID4}" ; Current version (or version independent prog ID) ; entries (what you get when you have "SQLAny" ; instead of "SQLAny.16") [HKEY_CLASSES_ROOT\SQLAny] @="SQL Anywhere OLE DB Provider" [HKEY_CLASSES_ROOT\SQLAny\Clsid] @="{GUID1}" [HKEY_CLASSES_ROOT\SQLAny\CurVer] @="SQLAny.16" [HKEY_CLASSES_ROOT\SQLAnyEnum] @="SQL Anywhere OLE DB Provider Enumerator" [HKEY_CLASSES_ROOT\SQLAnyEnum\Clsid] @="{GUID2}" [HKEY_CLASSES_ROOT\SQLAnyEnum\CurVer] @="SQLAnyEnum.16" [HKEY_CLASSES_ROOT\SQLAnyErrorLookup] @="SQL Anywhere OLE DB Provider Extended Error Support" [HKEY_CLASSES_ROOT\SQLAnyErrorLookup\Clsid] @="{GUID3}" [HKEY_CLASSES_ROOT\SQLAnyErrorLookup\CurVer] @="SQLAnyErrorLookup.16" [HKEY_CLASSES_ROOT\SQLAnyA] @="SQL Anywhere OLE DB Provider Assist" [HKEY_CLASSES_ROOT\SQLAnyA\Clsid] @="{GUID4}" [HKEY_CLASSES_ROOT\SQLAnyA\CurVer] @="SQLAnyA.16" ; Standard entries (Provider=SQLAny.16) [HKEY_CLASSES_ROOT\SQLAny.16] @="Sybase SQL Anywhere OLE DB Provider 16.0" [HKEY_CLASSES_ROOT\SQLAny.16\Clsid] @="{GUID1}" [HKEY_CLASSES_ROOT\SQLAnyEnum.16] @="Sybase SQL Anywhere OLE DB Provider Enumerator 16.0" [HKEY_CLASSES_ROOT\SQLAnyEnum.16\Clsid] @="{GUID2}" [HKEY_CLASSES_ROOT\SQLAnyErrorLookup.16] @="Sybase SQL Anywhere OLE DB Provider Extended Error Support 16.0" [HKEY_CLASSES_ROOT\SQLAnyErrorLookup.16\Clsid] @="{GUID3}" [HKEY_CLASSES_ROOT\SQLAnyA.16] @="Sybase SQL Anywhere OLE DB Provider Assist 16.0" [HKEY_CLASSES_ROOT\SQLAnyA.16\Clsid] @="{GUID4}" ; SQLAny (Provider=SQLAny.16) [HKEY_CLASSES_ROOT\CLSID\{GUID1}] @="SQLAny.16" "OLEDB_SERVICES"=dword:ffffffff [HKEY_CLASSES_ROOT\CLSID\{GUID1}\ExtendedErrors] @="Extended Error Service" [HKEY_CLASSES_ROOT\CLSID\{GUID1}\ExtendedErrors\{GUID3}] @="Sybase SQL Anywhere OLE DB Provider Error Lookup" [HKEY_CLASSES_ROOT\CLSID\{GUID1}\InprocServer32] @="d:\\mypath\\bin32\\myoledb16.dll" "ThreadingModel"="Both" [HKEY_CLASSES_ROOT\CLSID\{GUID1}\OLE DB Provider] @="Sybase SQL Anywhere OLE DB Provider 16.0" [HKEY_CLASSES_ROOT\CLSID\{GUID1}\ProgID] @="SQLAny.16" [HKEY_CLASSES_ROOT\CLSID\{GUID1}\VersionIndependentProgID] @="SQLAny" ; SQLAnyErrorLookup [HKEY_CLASSES_ROOT\CLSID\{GUID3}] @="Sybase SQL Anywhere OLE DB Provider Error Lookup 16.0" @="SQLAnyErrorLookup.16" [HKEY_CLASSES_ROOT\CLSID\{GUID3}\InprocServer32] @="d:\\mypath\\bin32\\myoledb16.dll" "ThreadingModel"="Both" [HKEY_CLASSES_ROOT\CLSID\{GUID3}\ProgID] @="SQLAnyErrorLookup.16" [HKEY_CLASSES_ROOT\CLSID\{GUID3}\VersionIndependentProgID] @="SQLAnyErrorLookup" ; SQLAnyEnum [HKEY_CLASSES_ROOT\CLSID\{GUID2}] @="SQLAnyEnum.16" [HKEY_CLASSES_ROOT\CLSID\{GUID2}\InprocServer32] @="d:\\mypath\\bin32\\myoledb16.dll" "ThreadingModel"="Both" [HKEY_CLASSES_ROOT\CLSID\{GUID2}\OLE DB Enumerator] @="Sybase SQL Anywhere OLE DB Provider Enumerator" [HKEY_CLASSES_ROOT\CLSID\{GUID2}\ProgID] @="SQLAnyEnum.16" [HKEY_CLASSES_ROOT\CLSID\{GUID2}\VersionIndependentProgID] @="SQLAnyEnum" ; SQLAnyA [HKEY_CLASSES_ROOT\CLSID\{GUID4}] @="SQLAnyA.16" [HKEY_CLASSES_ROOT\CLSID\{GUID4}\InprocServer32] @="d:\\mypath\\bin32\\myoledba16.dll" "ThreadingModel"="Both" [HKEY_CLASSES_ROOT\CLSID\{GUID4}\ProgID] @="SQLAnyA.16" [HKEY_CLASSES_ROOT\CLSID\{GUID4}\VersionIndependentProgID] @="SQLAnyA" |
Registry value names are case sensitive.
Use the Microsoft Visual Studio uuidgen utility to create 4 sequential UUIDs (GUIDs).
For example, run the following command at a command prompt:
uuidgen -n4 -s -x >oledbs.txt |
The 4 UUIDs or GUIDs are assigned in the following sequence:
The Provider class ID (GUID1 below).
The Enum class ID (GUID2 below).
The ErrorLookup class ID (GUID3 below).
The Provider Assist class ID (GUID4 below). This last GUID is not used in Windows Mobile deployments.
It is important that they are sequential, which is what -x option in the command line does.
Each GUID should appear similar to the following:
Name | GUID |
---|---|
GUID1 | 41dfe9f3-db92-11d2-8c43-006008d26a6f |
GUID2 | 41dfe9f4-db92-11d2-8c43-006008d26a6f |
GUID3 | 41dfe9f5-db92-11d2-8c43-006008d26a6f |
GUID4 | 41dfe9f6-db92-11d2-8c43-006008d26a6f |
The first part of the GUID (for example, 41dfe9f3) that is incrementing.
Use the search/replace capability of an editor to change the GUID1, GUID2, GUID3, and GUID4 in the text to the corresponding GUID (for example, GUID1 would be replaced by 41dfe9f3-db92-11d2-8c43-006008d26a6f if that was the GUID generated for you by uuidgen).
Choose your Provider name that is used in your application in connection strings, and so on (for example, Provider=SQLAny).
The following names are reserved by SQL Anywhere and cannot be used as a Provider name:
Version 10 or later | Version 9 or earlier |
---|---|
SAOLEDB | ASAProv |
SAErrorLookup | ASAErrorLookup |
SAEnum | ASAEnum |
SAOLEDBA | ASAProvA |
Use the search/replace capability of an editor to change all the occurrences of the string SQLAny to the provider name that you have chosen. This includes all those places where SQLAny may be a substring of a longer string (for example, SQLAnyEnum).
Suppose you chose Acme for your provider name. The names that will appear in the HKEY_CLASSES_ROOT registry hive are shown in the following table along with the SQL Anywhere names (for comparison).
SQL Anywhere provider | Your custom provider |
---|---|
SAOLEDB | Acme |
SAErrorLookup | AcmeErrorLookup |
SAEnum | AcmeEnum |
SAOLEDBA | AcmeA |
Make copies of the SQL Anywhere provider DLLs (dboledb16.dll and dboledba16.dll) under different names.
copy dboledb16.dll myoledb16.dll copy dboledba16.dll myoledba16.dll |
There is no dboledba16.dll for Windows Mobile.
A special registry key will be created by the script that is based on the DLL name that you choose. It is important that the name be different from the standard DLL names (such as dboledb16.dll or dboledba16.dll). If you name the provider DLL myoledb16 then the provider will look up a registry entry in HKEY_CLASSES_ROOT with that same name. The same is true of the provider schema assist DLL. If you name the DLL myoledba16 then the provider will look up a registry entry in HKEY_CLASSES_ROOT with that same name. It is important that the name you choose is unique and is unlikely to be chosen by anyone else. Here are some examples.
DLL name(s) chosen | Corresponding HKEY_CLASSES_ROOT\name |
---|---|
myoledb16.dll | HKEY_CLASSES_ROOT\myoledb16 |
myoledba16.dll | HKEY_CLASSES_ROOT\myoledba16 |
acmeOledb.dll | HKEY_CLASSES_ROOT\acmeOledb |
acmeOledba.dll | HKEY_CLASSES_ROOT\acmeOledba |
SAcustom.dll | HKEY_CLASSES_ROOT\SAcustom |
SAcustomA.dll | HKEY_CLASSES_ROOT\SAcustomA |
Use the search/replace capability of an editor to change all the occurrences of myoledb16 and myoledba16 in the registry script to the two DLL names you have chosen.
Use the search/replace capability of an editor to change all the occurrences of d:\\mypath\\bin32\\ in the registry script to the installed location for the DLLs. Be sure to use a pair of slashes to represent a single slash. This step must be customized at the time of your application install.
Save the registry script to disk and run it.
Give your new provider a try. Do not forget to change your ADO / OLE DB application to use the new provider name.
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |