Tuesday 27 September 2011

Get connection to APPS schema without knowing APPS password in EBS

 

First of all I need to explain that this post will not explain how to get the APPS password , but will explain how to obtain JDBC connection object.

   Each one who ever developed Oracle Framework page knows that you don’t really need to specify APPS password to work with EBS. But you do need to specify location of dbc file. Why? Because there is an option to get “Connection” object by using dbc file.

   First of all how do you know what dbc file to use?

dbc name can be obtained from the profile called  “Applications Database ID” (APPS_DATABASE_ID). You can get it from EBS  profile directly or by using:

select fnd_profile.VALUE('APPS_DATABASE_ID') from dual

Lets call the value of profile DBC_VALUE.

So , the location of dbc file will be $FND_SECURE/DBC_VALUE.dbc

Now , when you know the location of dbc file we can obtain JDBC connection.

We will use the following code:

 

import java.sql.*;

//this classes located under $OA_JAVA in EBS
import oracle.apps.fnd.common.AppsContext;
import oracle.apps.fnd.common.VersionInfo;

public class GetConnection
{
public GetConnection(String dbcFileLocation)
{
AppsContext ac
= new AppsContext(pDbcFile);
Connection sConn
= ac.getJDBCConnection();
}
//do whatever you want after you get Connection
}

The connection object that you get connected to , is APPS user. From this point you can do whatever operation with database that APPS user is privileged to do