Error in Driver

Discussions

EJB programming & troubleshooting: Error in Driver

  1. Error in Driver (4 messages)

    In my weblogic property file i have this code for connection pooling ..

    weblogic.jdbc.connectionPool.oraclePool=\
            url=jdbc:oracle:thin:@10.9.8.101:1521:edweb,\
            driver=oracle.jdbc.driver.OracleDriver,\
            initialCapacity=4,\
            maxCapacity=10,\
            capacityIncrement=2,\
            props=user=edweb;password=edweb
     weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=everyone

    when i start the weblogic server it makes the connection pool successfully

    Now when i am making a query to my backend via bean i am getting an error

    the code is

    public String validateUser(String userId, String pwd) throws RemoteException, SQLException
     {
      Statement stmt = null;
      ResultSet rs = null;

      String strQuery = "Select * from ED_User where ED_USER_ID = '"+userId+"' and ED_PASSWORD ='"+pwd+"'";
    System.out.println("strQuery"+strQuery);
      try
      {
       //Class.forName("weblogic.jdbc.pool.Driver").newInstance();
       System.out.println("#################");
       Connection conn= DriverManager.getConnection("weblogic.jdbc.connectionPool.oraclePool",null);
       System.out.println("#################" + conn);
       stmt = conn.createStatement();
       rs = stmt.executeQuery(strQuery);
      }
      catch(Exception e)
      {
       System.out.println("Exception in getting stmt ::: "+ e);
      }

      if(rs.next())
      {


       return "SUCCESS";
      }
      else
      {
       return "FAILURE";
      }

     }

    And the error is

    Thu Mar 29 20:37:18 CST 2001:<I> <ServletContext-General> classes: init
    In the constructor of AuthenticateBean::
    In the SessionContext method
    Calling ejbCreate method ::
    strQuerySelect * from ED_User where ED_USER_ID = 'Rinku' and ED_PASSWORD ='Rinku
    '
    #################
    Exception in getting stmt ::: java.sql.SQLException: No suitable driver
    Thu Mar 29 20:37:19 CST 2001:<I> <EJB JAR deployment D:/rinky1.jar> Exception in
     non-transactional EJB invoke:
    java.lang.NullPointerException:
            at com.mphasis.ttsh.ed.authentication.AuthenticateBean.validateUser(Auth
    enticateBean.java:40)
            at com.mphasis.ttsh.ed.authentication.AuthenticateBeanEOImpl.validateUse
    r(AuthenticateBeanEOImpl.java:98)
            at com.mphasis.ttsh.ed.authentication.AuthenticateBeanEOImpl_WLSkel.invo
    ke(AuthenticateBeanEOImpl_WLSkel.java:90)
            at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerOb
    jectAdapter.java, Compiled Code)
            at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques

    i dont understand what is the problem .Please tell me .

    Thanks in advance
    Rinku

    Threaded Messages (4)

  2. Error in Driver[ Go to top ]

    hi,
       r u using cmp or bmp..ur code shows ur using bmp..u already specified ur driver in peoperties file..so u dont need to give it in ur code again..if u want a clear idea
    try some examples..examples come with weblogic server
  3. Error in Driver[ Go to top ]

    hi kartik,

    No its a CMP bean .And in the weblogic examples there is no session beans example.
  4. Error in Driver[ Go to top ]

    Try replacing the getting of Connection with :-

    InitialContext initCtx = null;
    DataSource ds = null;

    try
    {
        initCtx = new InitialContext();

        ds = (DataSource) initCtx.lookup("weblogic.jdbc.jts.oraclePool");
    }
    catch
    {
      .... whatever
    }

    Connection conn = ds.getConnection();

    etc....

    make sure you have the following line in weblogic.properties :-

    weblogic.jdbc.TXDataSource.weblogic.jdbc.jts.oraclePool=oraclePool

    Cheers,
    Rick
  5. Error in Driver[ Go to top ]

    hai again,
              theres no need to write the connection codings and queries for cmp..the container will do everything for u..all u need to do is to write finder methods..thats it