Jdbc dynamic credentials

How does one go about implementing JDBC dynamic credentials as suggested by this article http://otn.oracle.com/products/jdev/howtos/bc4j/howto_dynamic_jdbc.html in UIX instead of JSP? Any pointers?
Thanks!
Ronny

I should preface this with a warning that I'm not all that familiar with what you are trying to do. However, it should be possible to use very similar code to what is shown in the How To document for JSPs. In the JSP example, the code is inline part of the JSP. uiXML doesn't mix code and UI, so this code would therefore be located in a method event handler.
The first thing to do would be to create a uiXML page with form fields for username and password. I would use a messageTextInput for these fields (with the secret attribute set to true for the password field). I would add a "Login" submitButton, and then add a ctrl:event="Login" attribute to the button so that it will fire a UIX Controller "Login" event.
I would add a handler for the "Login" event in the handlers section of the uiXML page, and use a method event handler to call out to Java code. The method event handler has access to the HTTPSession and the submitted username and password, so you should be able to get the HTTPContainer and manipulate the session. The only major difference with the JSP example, would be that the JSP example uses the <jbo:ApplicationModule> tag in a try/catch block to attempt the connection, and you would need to use the regular BC4J Java APIs. If the connection was sucessful, your event hander would return an EventResult for the next paeg in your application, if there was an error you could return an event result for the same page displaying the error (as discussed in the Handling Errors chapter of the UIX Developer's Guide).
Whenever discussing login procedures, it is worth pointing out the TrivialPageFlowEngine in the UIX Controller which is useful in enforcing that the user has gone through your login procedure prior to jumping to any page in the application.
Hope this helps!

Similar Messages

  • [SOLVED]JDBC Dynamic credentials problem

    Hello everyone. I have been trying to implement Steve Muench example 14 about JDBC Dynamic Credentials on my own web app., I am using Jdeveloper 10.1.3.2 and JSF/ADF.
    The thing is that the JDBC dynamic credential works well but when I enter a non-existant username/password the login.jsp page sends me to the main.jsp page and in the table that I have placed there (in the main.jsp page) it shows "Access Denied". Is there any way to tell the app. to redirect the users to the login.jsp page if they try to acces other parts of the app. and they are not logged in???, or is it thay I am missing something from the Steve Muench's example???
    I have been cheking the "DynamicJDBCBindingFilter.java" code and, if I understand correctly ('cause I consider myself a newbe), the "super.doFilter(request, response,chain)" is suppoused to throw an exception if the authentication fails and the "catch" code then sends the user to the login.jsp page... but for some reason this doesn't work!!!
    Can anybody help me on this one please?
    Thanks.
    * By the way, no errors are thrown!
    Message was edited by:
    dragonov7

    Hi Frank, thanks for your response. That same idea crossed my mind but the thing is that the line "super.doFilter(request, response,chain);" is supouseded to throw an exception if it fails to do its job but for some reason it does not... I have placed a "System.out.printline("XXX");" line inmediatly after the "catch" statement to see if an exception is thrown but apparently it doesn't, so I can't set a flag if I don't know for sure if the process ended well (or wrong).
    I think I'll clear my mind for 1 hour and start all over again... maybe I am missing something...

  • Problems JDBC Dynamic Credentials

    Considered:
    I am using Jdev 10.1.2 with ADF, and in the application that I use we have implemented the use of DynamicJDBCCredentials. The particularitity is that the work form is the following one, When initiating, the application must be connected with a user that is taken pre-defined from a file properties, this will show the screen of login, in which the user along with enters his data the selection of the company that wish, when doing this and to press ok, the application would have to change to the user and password of which appmod this connecting itself to the DB, the seteos of user/password takes control correctly, but appmodule does not change the connection and I do not understand because… somebody Will be able to help me with this? From already thank you very much.
    Estimados: Estoy usando Jdev 10.1.2 con ADF, y en la aplicacion que utilizo hemos implementado el uso de DynamicJDBCCredentials. La particularidad es que la forma de trabajo es la siguiente, Al iniciar, la aplicacion debe conectarse con un usuario que se toma pre-definido desde un archivo properties, esto mostrará la pantalla de login, en la cual el usuario ingresa sus datos junto con la seleccion de la empresa que desea, al hacer esto y presionar ok, la aplicacion debería cambiar el usuario y password con el cual el appmod se esta conectando a la DB, los seteos de user/password se hacen correctamente, pero el appmodule no cambia la conexion y no entiendo porque ... Podrá alguien ayudarme con esto? Desde ya muchas gracias.

    I should preface this with a warning that I'm not all that familiar with what you are trying to do. However, it should be possible to use very similar code to what is shown in the How To document for JSPs. In the JSP example, the code is inline part of the JSP. uiXML doesn't mix code and UI, so this code would therefore be located in a method event handler.
    The first thing to do would be to create a uiXML page with form fields for username and password. I would use a messageTextInput for these fields (with the secret attribute set to true for the password field). I would add a "Login" submitButton, and then add a ctrl:event="Login" attribute to the button so that it will fire a UIX Controller "Login" event.
    I would add a handler for the "Login" event in the handlers section of the uiXML page, and use a method event handler to call out to Java code. The method event handler has access to the HTTPSession and the submitted username and password, so you should be able to get the HTTPContainer and manipulate the session. The only major difference with the JSP example, would be that the JSP example uses the <jbo:ApplicationModule> tag in a try/catch block to attempt the connection, and you would need to use the regular BC4J Java APIs. If the connection was sucessful, your event hander would return an EventResult for the next paeg in your application, if there was an error you could return an event result for the same page displaying the error (as discussed in the Handling Errors chapter of the UIX Developer's Guide).
    Whenever discussing login procedures, it is worth pointing out the TrivialPageFlowEngine in the UIX Controller which is useful in enforcing that the user has gone through your login procedure prior to jumping to any page in the application.
    Hope this helps!

  • JDBC Dynamic Credential with proxy users

    Hi
    We've developed an application with Business Components and it's been working very well. We're using JDBC Dynamic Credential like explain the document (How to Support JDBC Dynamic Credentials - http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html). Now we want to use proxy users with JDBC Dynamic Credentials. How can we
    user proxy users with JDBC Credentials? What classes or parameters we need to change?
    I've been tested proxy users a lot, but in simple java classes, I don't know where to set some parameters in business components, for example, where can I set the following parameters?:
    OracleOCIConnectionPool.PROXY_USER_NAME
    OracleOCIConnectionPool.PROXYTYPE_USER_NAME
    Thanks in advance
    Liceth

    Hi Frank, thanks again
    Now we are using JDBC Credentials(like explain the paper http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html), every user connects to the application with a diferent database user and password, then at database level the administrator can see diferents usernames (not the same user). Every application user correspond to a database user, relation one to one. The application works fine with that configuration. But, now for performance we want to change our application to use proxy users, I read that with proxy users redirectec to a single user, then the pooling connections are well reused, and at database level you have diferent usernames. Our principal goal is use pooling (for performance) and see diferent usernames at database level, this for facilitate administration tasks and auditory .
    We want that the application user autenticate with proxy users (username and password) but we have some problems because we don't know where specify that we're using proxy users. (The parameters OracleOCIConnectionPool.PROXY_USER_NAME
    OracleOCIConnectionPool.PROXYTYPE_USER_NAME).
    We want open our connections with the following code:
    OracleOCIConnectionPool ods = new OracleOCIConnectionPool();
    ods.setURL("jdbc:oracle:oci:@"+tnsAlias);
    ods.setUser("user_application");
    ods.setPassword("oracle");
    java.util.Properties prop = new java.util.Properties();
    prop.setProperty(OracleOCIConnectionPool.CONNPOOL_MIN_LIMIT,"3");
    prop.setProperty(OracleOCIConnectionPool.CONNPOOL_MAX_LIMIT,"20");
    prop.setProperty(OracleOCIConnectionPool.CONNPOOL_INCREMENT,"1");
    ods.setPoolConfig(prop);
    java.util.Properties userNameProp = new java.util.Properties();
    userNameProp.setProperty(OracleOCIConnectionPool.PROXY_USER_NAME,"Mark/123");
    Connection conn = ods.getProxyConnection(OracleOCIConnectionPool.PROXYTYPE_USER_NAME,userNameProp);
    with other user
    userNameProp.setProperty(OracleOCIConnectionPool.PROXY_USER_NAME,"Marty/123d");
    Connection conn = ods.getProxyConnection(OracleOCIConnectionPool.PROXYTYPE_USER_NAME,userNameProp);
    Thanks in advance
    Liceth

  • Dynamic Credentials with Webservice

    I'm developing a web service and need to establish a database connection based on a heavyweight user in the database. (Please...no discussion on that design...it is what it is at least for now.)
    So far I've created a class defining the service method. (This will be converted to a webservice later using the wizard.) I've created a separate project containing an AppModule through which I'll access the datasource.
    Use of dynamic credentials for web apps is discussed here: http://www.oracle.com/technology/products/jdev/howtos/bc4j/howto_dynamic_jdbc.html. However the example depends on the lifecycle's calling a subclass of SessionCookieFactory and passing of the UID/password via HttpSession object attributes. I'm assuming that a webservice would not have a call to the SessionCookieFactory in its lifecycle.
    Is there a way in a webservice design to dynamically set the username and password for the connection? I'm using an AppModuleImpl subclass in my project, but I haven't seen any methods for changing the username/password before or after my call to Configuration.createRootApplicationModule(String a, String b). {My connection string is defined in a database connection in the Connections Navigator.}
    I'm developing in JDev 10.1.3.1.

    OK...I was able to make this work by modifying the dynamic JDBC example:
    public Element serviceMethod(String username, String password, String parameter) {
    String amDef="mypkg.AppModule";
    String config="AppModuleLocal";
    ServiceEnvInfoProvider envInfo = new ServiceEnvInfoProvider(username, password);
    AppModuleImpl module = (AppModuleImpl)Configuration.createRootApplicationModule(amDef, config, envInfo);
    Element resultElement = processingMethod(parameter);
    return resultElement;
    }

  • Dynamic Credentials and Web Service Data Controls

    I've followed Steve Muench's post on using Dynamic Credentials (14.     Dynamic JDBC Credentials for Model 1 and Model 2 [10.1.3.2] 2006, Upd: 17-MAY-2007), which works fine with the ADF BC part of the project. However, the project also contains Data Controls created from web services. I'm getting the following exception. Why are the web services being effected by the credentials and how can I fix it?
    Aug 31, 2007 12:38:41 PM oracle.adf.model.adapter.DataControlFactoryImpl createSession
    SEVERE: Exception:
    oracle.adf.model.adapter.AdapterException: DCA-40012: Failed to create a connection to the Web Service.
         at oracle.adfinternal.model.adapter.webservice.WSDefinition.loadFromMetadata(WSDefinition.java:659)
         at oracle.adf.model.adapter.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:163)
         at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:76)
         at oracle.adf.model.BindingContext.get(BindingContext.java:457)
         at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:280)
         at oracle.adf.model.binding.DCUtil.findSpelObject(DCUtil.java:248)
         at oracle.adf.model.binding.DCUtil.findContextObject(DCUtil.java:383)
         at oracle.adf.model.binding.DCIteratorBinding.<init>(DCIteratorBinding.java:127)
         at oracle.jbo.uicli.binding.JUIteratorBinding.<init>(JUIteratorBinding.java:60)
         at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.<init>(JUMethodIteratorDef.java:138)
         at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:93)
         at oracle.jbo.uicli.binding.JUMethodIteratorDef.createIterBinding(JUMethodIteratorDef.java:84)
         at oracle.adf.model.binding.DCIteratorBindingDef.createExecutableBinding(DCIteratorBindingDef.java:277)
         at oracle.adf.model.binding.DCBindingContainerDef.createExecutables(DCBindingContainerDef.java:296)
         at oracle.adf.model.binding.DCBindingContainerDef.createBindingContainer(DCBindingContainerDef.java:425)
         at oracle.adf.model.binding.DCBindingContainerReference.createBindingContainer(DCBindingContainerReference.java:54)
         at oracle.adf.model.binding.DCBindingContainerReference.getBindingContainer(DCBindingContainerReference.java:44)
         at oracle.adf.model.BindingContext.get(BindingContext.java:483)
         at oracle.adf.model.BindingContext.findBindingContainer(BindingContext.java:313)
         at oracle.adf.model.BindingContext.findBindingContainerByPath(BindingContext.java:633)
         at oracle.adf.controller.v2.context.LifecycleContext.getBindingContainer(LifecycleContext.java:150)
         at com.awiweb.om.view.fwkExts.OMS_FacesPageLifecycleContext.initControllerClass(OMS_FacesPageLifecycleContext.java:23)
         at oracle.adf.controller.v2.context.LifecycleContext.<init>(LifecycleContext.java:53)
         at oracle.adf.controller.v2.context.PageLifecycleContext.<init>(PageLifecycleContext.java:48)
         at oracle.adf.controller.faces.context.FacesPageLifecycleContext.<init>(FacesPageLifecycleContext.java:37)
         at com.awiweb.om.view.fwkExts.OMS_FacesPageLifecycleContext.<init>(OMS_FacesPageLifecycleContext.java:17)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at oracle.adf.controller.v2.context.LifecycleContext.getInstance(LifecycleContext.java:86)
         at oracle.adf.controller.v2.context.LifecycleContext.getInstance(LifecycleContext.java:65)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$1.before(ADFPhaseListener.java:404)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:77)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:228)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)
         at com.awiweb.om.view.fwkExts.OMS_ADFBindingFilter.doFilter(OMS_ADFBindingFilter.java:79)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)

    Please ignore this post. The problem was not related to the Web Service.

  • Dynamic credentials

    I am using dynamic credentials in my adf 11g application ,i want after user make login, to store his basic information - (name,salary,birthdate,...etc) which is store in database - to session variables to use these variables in all pages . how can i do that ?
    thanks in advance
    maher

    Maher,
    the ideal point is the method where you are sure the user has successfully logged into your system.
    There you get hold of the session, check if the bean is already instantiated and set its values. If you can't find the bean create it yourself and put it into the session.
    Timo

  • Differend between JAZN and Dynamic Credentials

    Please dose someone hase an article about this?? I want a clear article where it describes the differend between these two.
    thank you

    Hi,
    I don't think that this topic is worth an article.
    The difference is that JAZN performs J2EE container managed authentication in OC4J, whereas dynamic credentials allows ADF BC users to have their own database connection to their own schema (instead of sharing a database connection which then could be database pooled). So we are talking about comparing apples and beans here
    Frank

  • Sender JDBC Dynamic parameter value in select query

    Hi All,
    I have a scnario where i have read only acess to a table and We cannot use stored procedures..
    Interface is JDBC to file.
    Now there is one filed in the table which holdes the system date and time.Ex filed name as Sysdate.
    now can i use  query as select * from table1 where Sysdate = x+1.
    where X is the last process Sysdate field value.. is there any work arround to store the value in a file and check dynamically every time from that file to get the value of x and after that X+1 value has to be updated back to that file..
    main aim is to eliminate duplicate entries.
    Regards
    Vijay

    Hi suraj,
    thanks for the reply i have proposed the same for the requirement but there is no acess to update the table all we have is to read only the table.. so i get out one other way round to ensure the proper data has to be flow..
    Similarly there is one more where i have datetime field value  i need to break all entires on base of time and pick the values ...
    Even i proposed if you thre is no authorization to update the flag give me in flat file so that i can split the file by uisng java mapping..
    But its was badluck i have a table with few lak entries read only aces to the table and ensure data has to be properly flow with out any duplications and miss entries.. any approach that we can achive this..
    Regards
    Vijay
    Edited by: vijay Kumar on Apr 12, 2010 1:36 PM

  • JDBC: Dynamic select statement

    Hi,
    I am working on a JDBC to SAP integration. I am trying to SELECT data from table for a specific time interval.
    In the JDBC configuration i am using the Query SQL Statement
    For example: select * from X where time='20080808'
    Now is it possible to use for example the system date and time of the server where pi is installed or any other dynamic data?
    Maybe like this: select * from X where time =@sysdate
    If it is possible how? If not why?
    I appreciate your help.
    Thanks in advance...

    Hi,
    In case of receiver JDBC you can map todays date to the select statement and make the select statement dynamic, however in the sender it can't be done. The work around may be to call the stored procedure from the sender adapter and using the stored procedure construct the select query dynamically.
    Thanks
    SaNv...

  • JDBC dynamic receiver configuration

    hi experts,
    i have about 20 datasources (databases). all of them use the same XI scenario. it means that on all databases the same work is done.
    now there is a problem, i dont want to create 20 jdbc receiver channels for each database to handle my scenario,
    is there a way to configure the jdbc receiver dynamically?
    if yes, any how-to would really help me.
    thanks in advance
    chris

    Database connection paramter is the mandatory for CC channel creating an is dependent on each CC creation.
    So going with the standard would be easy and your question is more valid sending same structure to different DB.
    But no option  as u wished.
    Developing Adapter Module would be quite challening but Database ip should be produced from the Outbound Interface r any value mapping has to happen based upon some validation from Outbound Interface.
    But doing all work around depends on u r interest an need intstead go for CC creation
    SAP has give so i guess it would be very narrow in monitoring the CC individually in poiting out the error specific
    regards
    srini

  • JDBC Dynamic Entry List

    Hi All,
    I'm trying to create a dynamic entry list based on JDBC stored procedure (SP).
    While configuring the output parameters I don't see any of the output fields of the SP.
    Any advice would be appreciated,
    Aviad

    Yes, you're right. This is because VC doesn't know the fields of the stored procedure until you test it, but it has to be done separately for each usage of the stored procedure, and you can't do it for entry lists.
    There is a workaround for it though.
    Wrap the store procedure with a service: create a service in the same DC (from the New Model dialog), drag the stored procedure to the service, test it and add the fields, and from the stored procedure drag data in and data out for all its ports. Then use that service in the entry list (when you define the entry list, choose "Visual Composer Models" in "search in").
    Best regards,
    Tal.

  • Help on Jdbc dynamic connection

    I am trying to create a dynamic pool with oracle where I am picking the poolname from the JNDI context and setting the connection properties but I am getting authorazition error even though I added user scott in connectionpoolcreate of weblogic6.1can any one suggest me to solve this problem
              

    Hi ...
    I didn't get any reply from any one....
    Is it possible to make Java Server Pages and RMI work together -
    to invoke a method on a server object from a JSP? And if, does
    someone know of a good tutorial, article etc., on this matter?
    waiting for ur reply!!!!

  • Configuration.createRootApplicationModule and dynamic credentials

    Hi,
    I'm trying to access business services of an ApplicationModule (AM B) from another ApplicationModule (AM A) (all in layer Model), using the static method oracle.jbo.client.Configuration.createRootApplicationModule.
    The problem that I've doing this, is that I do some initializations in Database (VPD, user context, ...) using prepareSession(SessionData) and UserData information acquired in the SessionCookie creation (with HttpSession information).
    Now with Configuration.createRootApplicationModule, I don't know how to pass the information that I need with EnvInfoProvider (if this is the way), or maybe I'm following a wrong way, and exists another better way to do what I pretend.
    Another question. Seems that createRootApplicationModule tries to use AM Pool, to obtain the AM, if exists any previous instance of the AM created by ADFBindingFilter/DataControl, this method will obtain the same instance or a new one?
    And the last one question about this theme, there's any way to obtain this AM in stateless mode release if the AM configuration file says that this will be released in Stateful mode? maybe using another additional configuration for the AM?
    Anybody could help me and rescue me from my ignorance of this world?
    Thanks a lot!!!

    repost

  • Dynamic JDBC credentials don't work

    Hello,
    I'm using OC4J 9.0.3 (build 020927.1699) for deploying BC4J components as EJB session beans.
    All my efforts to activate dynamic JDBC credentials are still without success.
    Client (JDev9032) implements EnvInfoProvider and returns new properties as described in the JBO-javadoc. Tracing oc4j shows that required properties are passed from the client but ignored as unknown:
    [332] (0) Copying unknown Client property (password='tiger') to session
    [334] (0) Copying unknown Client property (user='scott') to session
    - and connection is made on behalf of default user from data-source config.
    Is it a bug or I misunderstood something ?
    Thanks
    Arkady

    Please discard.
    The reason is in JDev9032, see BUG: JDBC dynamic credentials do not work

Maybe you are looking for