Monday, March 15, 2010

Database Connections in JDeveloper 11

JDeveloper 11 Technology introduces a new way to create and manage database connections. Now Database connections can be defined in two ways:
  1. For an application--You can create a database connection owned by and deployed with the current application, which is listed in Application Resource
  2. For the IDE as a whole--You can also create a connection that can be added to any application (i.e., IDE Connections), which is listed in both Resource Palette and Database Navigator.

Before you can use an IDE connection, you need to add it to your application as shown in the figure:

Creating Database Connections

If the data sources of your business components are from database, you need to create database connections to access them in your applications. Creating database connection can be either initiated by the user or triggered by other events such as creating the first business component in your application or importing an ADF library JAR which includes a connection.

In this article, we'll look at these different scenarios.

Creating the First Business Component

When you create the first business component, say, use the following steps:
  • New > Business Tier > ADF Business Components > Business Components from Tables
JDeveloper will prompt you with an "Initialize Business Components Project" dialog because it detects that your selected project has not yet been initialized for Business Components. In this initialization step, you need to specify the database connection as shown here:

Importing an ADF Library JAR with Connections

If the project you are packaging into an ADF Library JAR includes a database connection, that information can be included in the JAR and may be available to the consuming project. Oracle ADF uses connection architecture which defines a connection as two parts:
  1. Connection name
  2. Connection details (or endpoint definition).
JDeveloper will present the producer of the JAR the option to package the connection name only or to include connection details with the connection name.

If a connection is present in the project, the packaged ADF Library JAR will contain a jar-connections.xml file and a jar-adf-config.xml file. They will be added to the META-INF directory. The jar-connections.xml file contains the connection name and other relevant connection information. The jar-adf-config.xml file stores the information about the credentials used for the connections. If connection credentials were also specified, then a jar-credential-jazn-data.xml will also be included for the credential store.

If the connection defined in the JAR is fully configured and there are no connection name conflicts with the consuming project, a new application connection will be added.

If you don't create extra business components after importing the packaged ADF Library JAR, you don't need to go through Initialize Project for Business Components step as described below. Just make sure your database connection settings are correct by opening it in Application Resources panel.

Initialize Project for Business Components

If you choose, you can create database connections in advance and initialize your project for business components using them.

As described before, IDE connections are located in either Resource Palette or Database Navigator. You can create new database connections from context menu as shown below:

After creating your IDE connections, you then add them to your application. Besides IDE connections, you can also create database connections for your application only. All database connections used by your application will be listed in Application Resources panel.

Besides creating database connections from context menu, you can also create database connections (in either IDE or application scope) from New Gallery using the following steps:
  • New > General > Connections > Database Connection

After creating database connections in your application, the next step is to initialize your project for business components. Selecting model project from your application, open its property from the context menu.
Selecting Business Component tab, check "Initialize Project for Business Components" and then select the database connection to be used for creating business components. Note that this connection is used specifically for:
  • JDeveloper Design-time and
  • Business Components Tester

and it is different from the one used at runtime when your web application is deployed to an Application Server. That's another topic for the next time.


  1. Database connection in ADF BC 11g
  2. Oracle Fusion Middleware Online Documentation Library 11g Release (
  3. Database Connections in JDeveloper 11
  4. Oracle JDeveloper


Mike said...

JDeveloper 11 Technology introduces a new & very easy way to create and manage database connections. This post explains regarding "Database connections in JDeveloper 11".
sap support costs

Blogger said...

Quantum Binary Signals

Get professional trading signals delivered to your mobile phone every day.

Follow our signals today and gain up to 270% a day.