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

Monday, 6 August 2012

Read response from invoking Siebel CRM “EAI HTTP Transport” business service

 

I wrote a post some time ago about how to call URL from Siebel CRM. This post will deal with processing the response from remote page.

So here you go, follow the instructions from my previous post and submit data to remote page. Many times you expect not only to send data, but also receive a response back.

To remind you , in order to send data you have to invoke

oService.InvokeMethod("SendReceive", oInputs, oOutputs);

Common sense tells you that response is probably located in object.


But if you try to run


oOutputs.GetValue();

You will get the following error message


PropertySet GetValue call failed. PropertySet Value is marked as binary data, starting with….

And this is because Siebel can process data only in UTF-16 encoding. If it is not, Siebel “thinks” that it is a binary data.

Bellow is very simple code to convert the HTTP output to a proper format


var oTransService = TheApplication().GetService("Transcode Service");
var oTransOutputs = TheApplication().NewPropertySet();
oOutputs.SetProperty(
"ConversionMode", "EncodingToString");
oOutputs.SetProperty(
"SourceEncoding", "CP1252");
oTransService.InvokeMethod(
"Convert", oOutputs, oTransOutputs);
var sResponse = oTransOutputs.GetValue();

After you execute it. You will fine HTTP response string in sResponse variable.

P.S. You can find more information in 536101.1 metalink note