The simpledao.java applet includes several standard J++ packages as well as classes specific to the DAOSample application. The following table describes the classes imported into simpledao.java.
Import statement | Description |
java.applet.* | Classes needed to create World Wide Web applets. |
java.awt.* | Abstract Window Toolkit (AWT). A machine-independent windowing toolkit. |
Simpledaoframe | Frame that is used when the applet is run as a stand-alone application. |
dao_dbengine | The Java class that creates the _DBEngine object. |
dao350.* | The Java DAO version 3.5 wrapper classes that were created by running the Java Type Library Wizard. |
com.ms.com.variant | The com.ms.com package contains classes that are necessary when using COM services from Java. For this applet, only the variant class is needed. |
The dao_dbengine class is a wrapper for the DAO _DBEngine object. To create a licensed COM component (such as DAO) from Java, you must use the IlicenseMgr interface. The license key for DAO can be found in the _dbdao.h file included in the DAO 3.5 SDK. The following code demonstrates how to create the DAO database engine using ILicenseMgr.
public class dao_dbengine { // The static public method creates the DBEngine object. static public _DBEngine create() { // The return value: _DBEngine result; // Create the License Manager object. ILicenseMgr mgr = new LicenseMgr(); // Use the License Manager to create the DBEngine. result = (_DBEngine) mgr.createWithLic( // The license key for the DAO DBEngine: "mbmabptebkjcdlgtjmskjwtsdhjbmkmwtrak", // The CLSID for the DAO DBEngine: "{00000010-0000-0010-8000-00AA006D2EA4}", // The aggregation IUnknown* punkOuter: null, // The ctxFlag to create in the in-process server: ComContext.INPROC_SERVER ); return result; } }