HOWTO: Passing a License Key to ADO from Java

Last reviewed: February 19, 1998
Article ID: Q169807
The information in this article applies to:
  • Microsoft Win32 Virtual Machine for Java
  • ActiveX Data Objects 1.0

SUMMARY

ActiveX Data Objects (ADO) are freely redistributable; however, you do have to pass a license key when using ADO 1.0 in order to properly instantiate ADO.

ADO/R, the Recordset-only version of ADO, does not require a license key.

MORE INFORMATION

The following program shows how to pass the license key to the first object you create with ADO. Before compiling and running this program, perform the following steps:

  1. Make sure you have registered ADO; see http://www.microsoft.com/oledb/download/download.htm#Update for more information.

  2. Run "JAVATLB.EXE /U:T msado10.dll" from the Program Files\Common Files\System\ADO folder.

The following code calls the ADO getConnectionTimeout() function:

   // Sample program to call the ADO getConnectionTimeout() function.
   import msado10.*;
   import com.ms.com.*;
   public class ADOTest {
      public static void main(String args[])
      {
       // Create the License Manager object
      _Connection MyADOConnection=null;
       ILicenseMgr mgr = new LicenseMgr();
       MyADOConnection = (_Connection) mgr.createWithLic(
                               // The license key for ADO
                               "gxwaezucfyqpwjgqbcmtsncuhwsnyhiohwxz",
                               // The CLSID for ADO Connection
                               "{00000293-0000-0010-8000-00AA006D2EA4}",
                               // The aggregation IUnknown* punkOuter
                               null,
                               // The ctxFlag to create in inproc server
                               ComContext.INPROC_SERVER  );
      int timeout = MyADOConnection.getConnectionTimeout();
      System.out.println("getConnectionTimeout() returned "+timeout);
      }
   }


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/
   http://support.microsoft.com/support/java/

Keywords          : kbcode adoengdb adovj JVM
Technology        : kbInetDev
Platform          : WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 19, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.