A simple embedded SQLJ program
The sample program Demo03.sqlj demonstrates the use of a named iterator to retrieve data from a database.
This simple program outlines a standard sequence for many HCL Informix® Embedded SQLJ programs:
- Import necessary Java™ classes.
- Declare an iterator class.
- Define the main() method.
All Java applications have a method called main, which is the entry point for the application (where the interpreter starts executing the program).
- Connect to the database.
The constructor of the application makes the connection to the database by calling the initContext() method of the ConnectionManager class.
- Run queries.
- Create an iterator object and populate it by running a query.
- Handle the results.
- Close the iterator.
You can find the Demo03.sqlj sample program code in the $INFORMIXDIR/jdbc/demo/sqlj directory.