Setting up the DAOSample Application

From Visual J++, open the Daosample.dsw project workspace file, which is located in the \Samples\Microsoft\Daosample folder.

You will need to create a Java class that wraps the DAO version 3.5 Automation interfaces. Visual J++ includes the Java Type Library Wizard, which you can use to create Java wrappers for COM interfaces.

For each type library imported, the Java Type Library Wizard creates a directory below the trusted library directory having the same name as the type library. For DAO 3.5, the Java Type Library Wizard creates the directory \Windows\System\Java\TrustLib\dao350. The Java Type Library Wizard fills that directory with .class files, one for each COM class and/or interface described in the type library. All the generated classes and interfaces are part of a Java package having the same name as the type library file.

Each .class file generated by the Java Type Library Wizard contains a special attribute identifying it as a wrapper for a COM class. When the Java Support in Internet Explorer sees this attribute on a class, it translates all Java method invocations on the class into COM function invocations on the COM class.

Û To create the Java wrappers for DAO version 3.5

  1. On the Tools menu, click Java Type Library Wizard.

  2. Select the Microsoft DAO 3.5 Object Library check box.

  3. Click OK.

After you have created the Java description of the COM component, the output window shows two useful types of information: the import statement and the Summary.txt file notice. It also specifies the Typelib conversion utility version.

Microsoft (R) Visual J++ Java Typelib Conversion Utility Version 1.01.7022
Copyright (C) Microsoft Corp 1996. All rights reserved.
import dao350.*;
C:\WINNT\java\trustlib\dao350\summary.txt(1): Class summary information created

Tool returned code: 0

The import statement is typically copied and inserted into the beginning of any Java source file that uses the COM component. The summary file (Summary.txt) lists the Java signatures of all the methods for the COM interfaces and classes described by the type library. You can open this file in Microsoft Developer Studio by double-clicking the file name in the output window.

To build the DAO Sample application, click Build on the Build menu. In the dialog box, enter simpledao as the class name.