# Specifying the Connection to the Database

Use the Connections dialog box to specify the database connection for your Business Components Project.

Connection | From the drop-down list, select the connection that you want to use. If these fields do not contain the proper information, click New to enter information for a new connection, or click Edit to edit an existing connection.
Username | The name of the user connecting to the database. If you want to change this value, click Edit to open the Connection dialog box.
Driver | The class name of the JDBC driver that will be used to connect to the database. If you want to change this value, click Edit to open the Connection dialog box.
URL | The URL for the JDBC connection. If you want to change this value, click Edit to open the Connection dialog box.
SQL Dialect | Select the type of SQL your application will use. For more information on SQL dialect, see About Developing Business Components for Foreign Datasources.
Type Map | Select the type map you will use. If you specified a custom type map, it will appear on this list. For more information on type maps, see About Type Maps.

From the dropdown list, select the Connection that you want to use. If the connection you choose does not contain the Username, Driver, and URL information you need, click New to enter information for a new connection or click Edit to edit the information for an existing connection.

## Specifying Database Connection Details

The Connection Details panel opens when you click New or Edit on the Connections panel. Use the Details panel to specify information on how JDeveloper connects to the database. The Connection Details panel displays two different sets of options depending on whether you choose JDBC or IIOP as your connection type.

When you have finished entering connection information, you can test your database connection.

### JDBC Connection Type

If you select JDBC as the connection type, enter the following information in the Connection Details panel:

Note: The Business Components for Java framework currently supports JDBC connections to either Oracle8i or Oracle8i Lite databases only. Connections that you specify here must be of this type.

1. Enter the Connection Name. This is the unique name by which JDeveloper identifies this connection. JDeveloper provides a unique name or you can enter your own connection name.
2. Enter the Username that identifies you to the datasource.
3. Enter the Password that lets you access the datasource.
4. Select the Include password in deployment archive checkbox to include the password in the deployed `connections.properties` file. This will prompt the runtime user to enter a password.
5. From the Select a JDBC driver dropdown list, select a JDBC driver. You can choose from these drivers:

> - Oracle JDBC Thin
> - Oracle JDBC OCI-8
> - Oracle JDBC OCI-7
> - Oracle Lite JDBC 4.0
> - Sun JDBC-ODBC Bridge

Note: Other JDBC is also available as a choice on the Select a JDBC driver dropdown list. However, this is not a valid choice for a Business Components for Java project.

The connection information you provide to JDeveloper depends on which driver you select. The following sections describe the specific connection methods and database information you must enter for each driver. When you have finished entering connection information, you can test your database connection.

### Connection Methods and Database Information for Oracle JDBC Thin, OCI-8, and OCI-7 Drivers

For the Oracle JDBC Thin, OCI-8, and OCI-7 drivers, you must supply the following information:

1. From the Select a connection method dropdown list, select a connection method. You can choose from these methods:

   > Named Host (Thin driver connections only)
   > Net Name-Value Pair (enables the Network Protocol dropdown list)
   > Existing TNS Names (enables the Network Protocol and TNS Service dropdown lists)

2. From the TNS Service dropdown list, select from the list of defined TNS service names.
3. Enter the Host ID to identify the machine where the datasource resides.
4. Enter the SID to identify the Oracle instance to use as a datasource.
5. Enter the Port number on which Oracle's TNS listener listens for Net8 connections.
6. The Network Protocol dropdown list is enabled when you select Net Name-Value Pair or Existing TNS Names as the named host. You can choose from these protocols:

> - TCP
> - SPX
> - NMP
> - BEQ
> - IPC

7. Enter any additional connection information in the Other field.
8. In the Row Prefetch combo box, enter the number of rows to prefetch to the client while a result set is being populated during a query. The row prefetch feature reduces the number of roundtrips to the server. The default value is 10.
9. In the Batch Value combo box, enter the number of inserts and updates that should be accumulated at the client before they are dispatched to the database. The default value is 1.
10. Select the Report TABLE REMARKS checkbox if you want the database to return TABLE REMARKS. Note that selecting TABLE REMARKS is expensive in terms of performance. This feature is off by default.

### Connection Methods and Database Information for Oracle Lite and other JDBC Drivers

Business Components for Java has full design-time and runtime support for building Business Components against Oracle8i Lite and foreign databases. This opens up a number of development scenarios, from designing a business components application that can work against a generic database, to custom database support, to switchable datasources. For more information, see the topic About Developing Business Components for Foreign Datasources.

## Testing the Database Connection

Click Test Connection to test your database connection. JDeveloper will respond with a "Success" message or with an exception.