MDAC 2.5 SDK - ADO


 

Using ADO with the Microsoft SDK for Java

See Also

The Microsoft SDK for Java is the developer kit for the Microsoft Internet Explorer environment. Tools, information, and samples are provided to help you develop Java programs and applets based on JDK 1.1 and the Microsoft Win32® virtual machine (Microsoft VM). The Microsoft SDK for Java is not tied to Microsoft Visual J++ and can be downloaded from http://www.microsoft.com/Java.

The Jactivex.exe utility generates classes from a type library but can only be invoked on the command line. This feature is not integrated with the Visual J++ development environment. Unlike the classes generated by the Java Type Library Wizard, you can step into the class wrappers created by the SDK. This is useful for debugging how your code uses the ADO wrapper classes.

This mechanism reads the ADO type library and generates classes that you can instantiate within your application. It generates those classes in the following location: \<windows directory>\Java\trustlib\msado15.

Creating an ADO application in Java using the Microsoft SDK for Java is fundamentally identical, from the perspective of source code, to using the Java Type Library Wizard. For sample code, see ADO Java Class Wrappers. The only real difference is in how you generate the wrapper classes in the first place, as demonstrated in the steps below.

To create an ADO project with the Microsoft SDK for Java:

  1. Run the following from a command prompt. You need to set the path to include the Microsoft SDK for Java Bin directory, or run the command from that location. Typically, the Microsoft SDK for Java is installed in the same location as Visual Studio. This is a single command statement.
    \<path to DevStudio>\<path to Java SDK>\bin\JactiveX.exe /javatlb "C:\program files\common files\system\ado\msado15.dll"
    
  2. Run the following command to compile the generated classes. The /g:t switch turns on generation of debug symbols so that you can trace into the .Java symbols. Remove it for release builds.
    jvc /g:t c:\<windows>\Java\trustlib\msado15\*.Java
    
  3. To use these files, open your project in Visual J++. From the Project menu, choose Add To Project. Select Files, and add all of the .JAVA files generated in the trustlib\msado15 directory to your project.