官术网_书友最值得收藏!

Connecting your application to a database

In this application, we want to display employees' data from the HR schema on a web browser and be able to navigate between different records using buttons that help us go to the first, next, previous, and last records; employees' information should be displayed in a form-based view.

In order to retrieve employees' information, we need to establish a connection with the HR database.

In this recipe, we will use JDeveloper to establish a connection between our new ADF application and the HR schema, which comes by default with the Oracle database.

How to do it…

In order to establish a connection with the HR schema, follow the ensuing steps:

  1. Expand the Connect to a Database checklist item from the checklist and click on the Create a Database Connection button that will open the Create Database Connection dialog.

    Tip

    You can also create a connection by navigating to File | New | From Gallery | General | Connections | Database Connection.

  2. Choose a connection name of your choice; I named it HRConnection for clarification.
  3. Change the username and password of the HR user to match your database's HR schema; make sure you are pointing to the right host.
  4. Click on the Test Connection button to make sure everything works fine, and if everything is fine, you should see a Success! message.
    How to do it…
  5. Click on OK to close the dialog box.
  6. Mark this item as done in the checklist as well.

How it works…

When working with applications in ADF, you will need to have connections in order to establish a communication channel with different systems. One of the important connections that will be usually needed is a database connection, which establishes a connection between your application and database.

When you entered the information, you provided the connection with all the information needed in order to connect to a specific user in a specific database instance.

Your connection can be an application-based resource like the one we configured in this recipe; alternatively, it can be inside JDeveloper's resource catalog, which can be helpful if you have multiple applications that use the same database connection.

After creating a database connection, we need to create the Business Service Layer that will use the database connection.

主站蜘蛛池模板: 海南省| 张家口市| 武清区| 罗江县| 钦州市| 利津县| 缙云县| 多伦县| 林周县| 萨迦县| 柳州市| 深泽县| 息烽县| 龙井市| 广州市| 宁夏| 霍邱县| 祁连县| 连南| 温宿县| 民乐县| 隆德县| 晋州市| 岳普湖县| 且末县| 冷水江市| 武城县| 平陆县| 宜兰市| 云南省| 高台县| 冷水江市| 育儿| 澄城县| 宁德市| 泸水县| 体育| 嘉鱼县| 咸阳市| 宁晋县| 来安县|