|
|
|
|
|
Generating a Java Database Applet or Application |
|
|
|
|
|
|
|
Code which uses Microsoft's Data Access Objects (DAO), ActiveX Data Objects (ADO), or Remote Data Objects (RDO) is converted to Java code which uses the Diamond Edge ADO library built on top of JDBC (Java Database Connectivity). Prior to generating the Java Applet, test your VB form to ensure it functions as desired. Figure 12: Java Applet Displaying Data from ODBC Data Source NOTE: The JDBC data source and database names you assign to an applet must exactly match the ODBC data source and database names used to test the Visual Basic form prior to converting it to a Java applet. For example, if you use an ODBC data source named "dmv " to test the Visual Basic form, you must use "dmv" as the JDBC data source name for the applet converted from the VB form.
Converting VB Code into Java Source CodeAfter you test the form to make sure the generated VB data access code works, click the Make Java button on
the VB Converter toolbar to generate Java source code including the corresponding JDBC data access code. Several types of files are used when converting your form into a Java applet. For example, if you convert a VB form named Applet1 into a Java applet, the following types of files are generated: Filename.................File Description Note: The above assumes that the file name and project or form name is the same. The Java file names are based on the name of the Form or Project.
Troubleshooting Java Conversion ProblemsBefore you use the Make Java button, check to make sure your code includes only supported VB statements that
can be automatically converted into Java syntax. If your VB code includes unsupported statements, you will receive
one or more syntax error messages that identify the problem(s). After you modify your VB code, click the Make Java
button again to convert it into Java. Refer to the Help file for information
on supported VB language statements and features.
Running the Generated Java ApplicationAfter you've converted your VB code into Java byte code, click the Run Java toolbar button to run the Java application.
The generated Java application retrieves data using the diamondedge.ado classes which are build on top of the java.sql
API, more commonly known as JDBC. The diamondedge.ado library is a 100% pure Java implementation of Microsoft's
Active Data Objects (ADO).
Viewing the Generated Java Data Access CodeYou can view the Java source code that is automatically generated in an ASCII text editor such as Windows Notepad.
Comparing the generated Java code to your original VB code provides an easy way to begin learning Java syntax.
The code is located in the output directory specified in the Options dialog. By default this is in the Java directory
underneath the "install directory."
Visual Basic GetRecordSet Procedure
JDBC Data Access Code
|
|
|
|
|
|
|