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

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.

主站蜘蛛池模板: 大足县| 安图县| 宁波市| 咸宁市| 宁化县| 健康| 沙田区| 纳雍县| 聊城市| 南投县| 德兴市| 高邮市| 上饶县| 广河县| 新巴尔虎左旗| 镇宁| 马龙县| 临海市| 北流市| 亳州市| 黔西县| 基隆市| 阳高县| 黄浦区| 孝感市| 拉萨市| 宣化县| 杭锦旗| 越西县| 双鸭山市| 衡东县| 武宣县| 夹江县| 合山市| 浙江省| 南和县| 克什克腾旗| 浑源县| 天柱县| 竹溪县| 嘉禾县|