!--a11y-->
Creating the SQLJ Connection
ContextTo access the database using SQLJ, you need to create a connection context class Ctxthat is associated with a JDBC DataSource. At runtime, an instance of this class represents a database connection.
You
must have created the
GettingStartedOpenSQLWeb
project.
O...
1. In the Java perspective, select GettingStartedOpenSQLWeb project and open its context menu.
2. Choose New ® Other. Choose Persistence in the left-hand pane and SQLJ Source in the right-hand pane.
3. Choose Next.
4. Enter Ctx in the Name field. To choose a package, use Browse… next to the Package field, and choose temp.persistence.gettingstarted.dao from the list.
5. Choose Finish.
6. The SQLJ file opens automatically once it has been created. Enter the following code:

package temp.persistence.gettingstarted.dao;
#sql public context Ctx with (dataSource = "java:comp/env/TMP_PERSISTENCE_EXAMPLE"); |
7. Save and close the file.
You have
created the SQLJ connection context for the example. Go on with
creating the ResultSet
iterator for the
employee data.
