X

An Oracle blog about BI Publisher

Email from EBS - Addendum

The fax article is on the way but since I came up with the email solution there has always been the niggling fact that I was putting the EBS user name/password openly into my java class ... there had to be a better a solution !



There is, and thanks to Ashish from the dev team and a little work I found it. The OA Framework UI uses a DBC file to define the connection and other information to the EBS database and we can use that to get a connection to the database instead of hard coding the connection.



The file resides under the $FND_TOP/secure directory, check it out you'll have one. It will look similar to this:

#DB Settings
#Sun Sep 04 13:02:20 PDT 2005
GUEST_USER_PWD=user/pwd
APPL_SERVER_ID=F936BF325610DB94E03023823E050DC825406294681422881503890572956133
FND_JDBC_BUFFER_DECAY_INTERVAL=300
APPS_JDBC_DRIVER_TYPE=THIN
FND_JDBC_BUFFER_MIN=1
GWYUID=user/pwd
FND_JDBC_BUFFER_MAX=5
APPS_JDBC_URL=jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=YES)
(FAILOVER=YES)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)
(HOST=your server)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=sid)))
FND_JDBC_STMT_CACHE_FREE_MEM=TRUE
FND_JDBC_STMT_CACHE_SIZE=200
TWO_TASK=yourdb
FND_MAX_JDBC_CONNECTIONS=500
FND_JDBC_USABLE_CHECK=false
FNDNAM=user
FND_JDBC_PLSQL_RESET=false
DB_PORT=1521
FND_JDBC_CONTEXT_CHECK=true
FND_JDBC_BUFFER_DECAY_SIZE=5
DB_HOST=your server


there is also an environment variable called $FND_SECURE which will point to the file location.
To take advantage of the file and its contents and make your java class a whole lot more secure you can pass the FND_SECURE value and the dbc file name to the class via the driver i.e. $FND_SECURE/file.dbc



Then in your class add the following:



import oracle.apps.fnd.common.AppsContext;
...

the getConnection method becomes very simple
  static Connection getConnection() throws SQLException, Exception
  {
       
        AppsContext aCont = new AppsContext(dbcLocation);
        Connection aConn  = aCont.getJDBCConnection();
        return (aConn);
       
  }




where dbcLocation is a string that holds the new parameter passed from the driver. The rest of the class remains the same.
So now you have a much more secure method to get the connection. Just be sure to close it after you have finished so the connection returns to the connection pool. Much cleaner, neater and faster :o)





 



 

Join the discussion

Comments ( 2 )
  • David Thursday, May 17, 2007
    Hi Tim,
    I've been trying to use the connection code that you posted. I always seem to get a NullPointerException
    Host [visiondev1.excel4apps.com], Name [null] and/or Port [1521] is null
    What should the value of name be? Is it the SID or SERVICE_NAME? Should this be included in the .dbc file.
    Any help will be appreciated.
    Thanks
    David
  • Tim Dexter Thursday, May 17, 2007

    Hi David


    You'll already have a dbc file, I was just replicating one of our dev environment files. So you should be able to just point to it ... you can send me your code if you like


    Tim

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.