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

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.

主站蜘蛛池模板: 丹寨县| 惠安县| 邢台市| 雷波县| 元氏县| 沙雅县| 嘉鱼县| 连平县| 镇安县| 临颍县| 榆社县| 会理县| 涞水县| 吉木萨尔县| 化隆| 平远县| 新竹县| 车险| 蒙城县| 株洲县| 宿州市| 乌海市| 河西区| 安平县| 巴中市| 马关县| 桐梓县| 白朗县| 铜川市| 颍上县| 昌都县| 白城市| 九台市| 通山县| 潮安县| 西吉县| 连云港市| 万荣县| 福清市| 浪卡子县| 北宁市|