Discussions

EJB programming & troubleshooting: Error in Getting Conn from the Dbpool

  1. Error in Getting Conn from the Dbpool (6 messages)

    I am unable to get a Connection using DataSource.getconnection(xxxUser, pswd). Am using Wl6.1 with Oracle thin driver.


    error-message:------------------ java.lang.SecurityException: Authentication for user xxxUser denied in realm weblogic -----------------------------------

    Guess am missing some DataSource security conf, acl .etc.

    The same call works in JBoss.
    In wl6.1, if I use DataSource.getconnection(), it works without any error.

    Datasource is taken from JNDI lookup. Any help to get around this issue is greatly appreciated.
  2. Any reason why you have to pass in user/pw for you call? since the Connection Pool already has these information in WebLogic setup and the DataSource is tied to this connection pool. What you should do is protected your JNDI lookup instead and make users authenticate themselves when doing a JNDI DataSource Lookup
  3. Brian,
    This requirement came through an unusal way, where the OracleDB has some storedprocedures. We are using those stored procedures in our Ejbs through our connection pool. Some procedures are Oracle-Role protected, so depending on the user of the Conection the stored-procedure O/p becomes different. As these stored-procedures were developed for a legacy Client-server application.

    Thats why I am trying to get DataSource.getConn(user, pswd) work. Hope this way I will get hold of an user-role-connection from a Connection pool (well thats what the DataSource interface seems to be, in javax.sql).

    If there are any other ways pls let me know, (one would be Role-based Conn pool !!)

    Sid
  4. Check out the programming weblogic JDBC and JNDI docs at:
    http://e-docs.bea.com/wls/docs61/pdf.html

    I remembered reading something about setting up connection pool dynamically in one of these docs.
  5. Hi,
     I faced the same problem with my code..I think In ur console u would have given ur user name in the ACL name entry..instead give it in the Properties entry.Hope it will work

    inian
  6. I am not a web logic user. But I believe following should solve the problem.

    What ever the component, in which the datasource look up is happening, in the deployment descriptor, resource refrence should have been defined.

    For example

     <resource-ref>
        <description>Orders DB dataSource</description>
        <res-ref-name>OrdersDataSource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
          </resource-ref>

    In your case, you might have set the <res-auth> to Container. It is erroneous to set the authentication type to Container and call DataSource.getConnection(user,password).
    So, if your intention is to call in the above fashion set the res-auth to Application, if you are using EJB, or Servlet, if you are using Servlets.

    Hope this will help.

    regards
    sankar
  7. http://java.sun.com/j2se/1.4/docs/guide/jdbc/getstart/datasource.html


    -anil