An important Query

Discussions

EJB programming & troubleshooting: An important Query

  1. An important Query (4 messages)

    Does any one has idea how to use the connection from the pool which is created at the startup of the weblogic. I tried using the same from the pool i can get the connection but when i call the createStatement method on it AbstractMethodError is thrown. I m following the same method as followed in the beanManaged eg of weblogic the only diff is that the eg has the entityBean where as mine is the Session Bean.

    Can any one help me it's bit urgent
    Can send the mail to sachinshah at hotvoice dot com
    Sachin

    Threaded Messages (4)

  2. An important Query[ Go to top ]

    Hi, The problem can be with Ur JDBC driver. Please check to see if Ur JDBC driver is supporting the latest JDBC API.
  3. An important Query[ Go to top ]

    It could be the strange thing is that when i m running the basic example which is provided by Weblogic from which i have taken the code to get the DataSource is working fine differences being the eg. is EntityBean and mine is a sessionBean which shouldn't be a problem and eg. calls the prepareStatement on the connection and i m saying the createStatement on connection.
  4. An important Query[ Go to top ]

    Could be attach the code where you are creating the statement.
  5. An important Query[ Go to top ]

    This is for getting the connection
    public Connection getConnection()
    throws RemoteException, SQLException
    {
      InitialContext initCtx;
      String ConLookUp;
      try
      {
        /* the value of ConnectionLookupName is java:comp/env/oracleDatasource txDatasource is set up in the weblogic properties file */
        ConLookUp = resource.getString("ConnectionLookupName");
        log("ConnectionLookupName -> " + ConLookUp);

        initCtx = new InitalContext();
        DataSource ds = (javax.sql.DataSource) initCtx.lookup(ConLookUp);

       return ds.getConnection();
      }
      catch(Exception e)
      {
    e.printStackTrace();
    throw new RemoteException(e.getMessage());
      }
      finally
      {
        try
        {
    if (initCtx != null)
    initCtx.close();
        }
        catch(NamingException e)
        {
    log("Error Closing Context");
        }
      }
    }

    public ResultSet executeStatement(String qry) throws java.rmi.RemoteException
    {
    try
    {
    Connection con = getConnection();
    Statement stmt = con.createStatement();

    log("Executing Query -> " + qry);
    ResultSet rs = stmt.execute(qry);

    return rs;
    }
    catch(Exception e)
    {
    e.printStackTrace();
    throw new RemoteException(e.getMessage());
    }
    finally
    {
    stmt.close();
    con.close();
    }
    }