0 Replies Latest reply: Sep 20, 2011 10:28 PM by 788177 RSS

    "Oracle Applications" Service Adapter with JDeveloper 11.1.1.5.0

    788177
      Hello,

      We are trying to create a BPEL process in JDeveloper Studio Edition Version 11.1.1.5.0
      We were hoping to use oracle.apps.fnd.ext.jdbc.datasource.AppsDataSource provider which comes with fndext.jar for making connection to E-BS and not use apps/apps user directly.
      Can this be done in JDeveloper and if YES, how?

      We were able to use AppsDataSource from a Java Program as shown below.
      import java.sql.Connection;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;
      
      import oracle.apps.fnd.ext.jdbc.datasource.AppsDataSource;
      
      public class Driver {
           public static void main(String[] argv) {
                new Driver();
           }
           
           private AppsDataSource ads;
           private void init(String u, String p, String dbcFile) {
                ads = null;
                try {
                     ads = new AppsDataSource();
                     ads.setDescription("iWareLogic AppsDataSource");
                     ads.setUser(u);
                     ads.setPassword(p);
                     ads.setDbcFile(dbcFile);
                } catch(Exception exp) {
                     exp.printStackTrace();
                     ads = null;
                }
           }
           
           private void dumpResultSet(ResultSet rs) {
                try {
                     int cc = rs.getMetaData().getColumnCount();
                     if(cc < 1) return;
                     
                     for(int i = 0; i < cc; ++i) {
                          System.out.print(rs.getMetaData().getColumnName(i+1));
                          System.out.print(" | ");
                     }
                     System.out.println();
                     
                     while(rs.next()) {
                          for(int i = 0; i < cc; ++i) {
                               System.out.print(rs.getObject(i+1));
                               System.out.print(" | ");
                          }
                          System.out.println();
                     }
                } catch (SQLException e) {
                     e.printStackTrace();
                }
           }
           
           private synchronized void query(String q) {
                if(this.ads == null) {
                     System.out.println("No valid AppsDataSource object.");
                }
                
                Connection con = null;
                Statement statement = null;
                ResultSet rs = null;
                try {
                     con = ads.getConnection();
                     statement = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                     rs = statement.executeQuery(q);
                     dumpResultSet(rs);
                } catch(Exception e) {
                     e.printStackTrace();
                }
           }
           
           // User you use here has to be assigned profile option FND_SERVER_DESKTOP_USER with
           // the node name you used to generate VIS_YOGESH-LAPTOP.dbc file (in this case)
           private Driver() {
                init("user_with_UMX|APPS_SCHEMA_CONNECT_role", "password", "D:/tools/eclipse_workspace/AppDataSource/VIS_YOGESH-LAPTOP.dbc");
                query("select * from v$version");
           }
      }
      regards, Yora