Oracle

When you need to connect to an Oracle database this component will help you. There are two ways of getting a connection; a direct connection or through a pool. For more info about pools see the Connections Pool section of the help.

Usage

Direct connection

Using a direct connection means that you connect to the database server directly using an IP address and a port. This is the easiest way since there is no configuration needed and it only requires a few parameters. However for production code, we strongly recommend you to look at connection pooling.

A connection is direct when the Connection pool option is not checked.

Basic fields

The first fields are self explanatory, enter the IP address or hostname in the Server field, the port in Port. User id and Password are your login credentials.

Database (service name)

Oracle uses what's called a service name:

A logical representation of a database, which is the way a database is presented to clients. A database can be presented as multiple services and a service can be implemented as multiple database instances. The service name is a string that is the global database name, that is, a name comprising the database name and domain name, entered during installation or database creation. If you are not sure what the global database name is, you can obtain it from the value of the SERVICE_NAMES parameter in the initialization parameter file.

This field specifies what service name you want the connection to use.

Properties

The Properties field allows you to specify any connection properties.

Direct connection example

OracleConnection oracon1 = new OracleConnection("10.0.0.13", 1521, "xe", "serobkle", "#$E%0xcGFzc3dvcmQ=", "");

Pooled connection

The recommended way to use connections is to use a connection pool. When you have a pool setup you check the Connection Pool option and select your pool from the helper icon. This will give you something like this:

OracleConnection oracon1 = (OracleConnection) PoolManager.instance().getIPool("myPool").getConnection();

If the list of pooled connection is empty you need to configure your pools in 360's administration tool. Please see the help section for Pool Connections.