This method can be used to automatically generate a filename for an access database that does not conflict with others. The names are all of the form "c:\winnt\system32\inetsvr\mpinstX.mdb" where "X" is a number. The idea here is to correlate the instance number for the LDAP server using the access database with the name of the database itself. Read mpinst3.mdb as "Membership and Personalization for LDAP instance 3."
IDL Definition
HRESULT GenerateJetFileName(
[in] DWORD dwID,
[out, retval] BSTR *pbstrFileName
);
Parameters
dwID
the identifier to attempt to append to the "mpinst" prefix in the database name. If the number conflicts with another database name, the next possible value is added, and that filename is returned.
pbstrFileName
on return, the address of a BSTR variable containing the generated filename.
Return Values
a standard HRESULT value
Remarks
The argument to this method is the "suggested" id for the name. If we are setting up LDAP instance number 3, we would send 3 as the argument. Filename clashed permitting, we would receive "c:\winnt\system32\inetsvr\mpinst3.mdb" from the method. However, if this file already exists, we would receive the next name available in the sequence. That is, if all numbers up to 6 are used (mpinst1.mdb … mpinst6.mdb") are used, the method would return "c:\winnt\system32\inetsvr\mpinst7.mdb"
Example
Set ObjCreator = CreateObject("ObjCreator.ObjCreator.1")
Set DSConfig = ObjCreator.CreateObjAuth("MemAdmin.DSConfig.1")
Filename = DSconfig.GenerateJetFilename(3) ' hope to use 3
DirName="company1"
DBUserName="ldapuser"
DBUserPass="passwordhere"
DBSuperPass="superpass"
fUseMembershipSecurity=1 ' true
call DSConfig.CreateJetDB(Filename, DirName, DBUserName, DBUserPass, DBSuperPass, fUseMembershipSecurity)
' go on to configure LDAP instance