< Previous | Next >

Lesson 1.3: Create a connection to a database

In this lesson you will learn how to add a connection to a sample Derby database.
Before you begin, you must complete Lesson 1.2: Add JPA support to the project.

Add a connection to the Derby sample database

  1. In Project Explorer, right-click JPATutorial and select Properties. The Properties for JPATutorial window opens.
  2. Click JPA.
  3. Make sure that RAD JPA Platform is selected in the Platform list.
  4. Click Add connection. The New Connection Profile wizard opens.
  5. In the connection profile type list, click Derby. In the Name field, type a name for your connection (for example, name it Myconn) and then click Next.
    Screen shot of New Connection Profile wizard.
    The New Derby Connection Profile wizard opens
  6. From the Drivers list at the top of the wizard, select Derby 10.2 - Embedded JDBC Driver Default.
  7. Select Connect every time the workbench is started.
  8. On the General tab of the Specify a Driver and Connection Details page of the Derby Embedded Database wizard, click Browse and select <workspace_location>JPATutorial\WebContent\sample and click OK.
    Screen shot of New Derby Connection Profile wizard.
  9. Click Test connection to ensure that you can connect to the Derby database. On the Success dialog-box, click OK. Click Next.
  10. Click Finish to complete the connection to the derby database.
    Screen shot showing JPA properties for the project with the database connection selected.
  11. On the JPA properties page, select Override default schema from connection and then select SAMP in the Schema list. Click Apply to apply the changes to your Web project, and then click OK.

Lesson checkpoint

You have completed Lesson 1.3. In this lesson, you learned how to add a connection to a Derby database.
< Previous | Next >

Feedback