Thursday 31 January 2013

Connect to Oracle EBS apps schema without password by using JDBC connection

 

The following post is not a hack. It just describes the method which is used by Oracle EBS to connect to APPS schema without providing username and password.

  The method will work only with Oracle Application EBS environment. Standalone Oracle databases have nothing to do with it. Also you need to understand that this method is for obtaining JDBC Connection object only

Lets start straight with a code, because it is very simple.

import oracle.apps.fnd.common.AppsContext;
import java.sql.*;

public class ConnectionToApps
{
public static void main(String[] args)
{
String dbcFile
= "Enter Here The Path To Dbc File";
Connection _conn
=null;
AppsContext ac
= new AppsContext(dbcFile);
_conn
= ac.getJDBCConnection();
}
}

Only 4 lines of code.


But the trick is to get the path to DBC file.


It is also simple. DBC files are located under $FND_SECURE directory (if connected to the server with application owner OS user)


Bellow is the shell example


/home/applDVIS12>cd $FND_SECURE
/space2/DVIS12/inst/apps/DVIS12_cow/appl/fnd/12.0.0/secure>ls
DVIS12.dbc
/space2/DVIS12/inst/apps/DVIS12_cow/appl/fnd/12.0.0/secure>


Obviously the correct file is DVIS12.dbc. But many times there are a lot of files in this directory. So how do you know the correct one.


It is also not a problem. The file name (without .dbc) always can be found by looking into “Applications Database ID” profile in EBS or by just running the following query



select fnd_profile.VALUE('APPS_DATABASE_ID') from dual
So now you have everything to assemble the PATH to DBC file


To summarize it , the path is $FND_SECURE/ + select fnd_profile.VALUE('APPS_DATABASE_ID') from dual +/.dbc