Samples EJB with JDBC

Discussions

EJB programming & troubleshooting: Samples EJB with JDBC

  1. Samples EJB with JDBC (5 messages)

    Please send me some JDBC (Oracle) samples if possible.

    TIA
    Felipe Soares

    Threaded Messages (5)

  2. Samples EJB with JDBC[ Go to top ]

    Which application server are using?
  3. Samples EJB with JDBC[ Go to top ]

    We are not sure yet. We might be using Weblogic, but as soon as we still don't know I would like to make a generic (portable) code, is that possible ?

    TIA
    Felipe Soares
  4. Samples EJB with JDBC[ Go to top ]

    Hi wisers,

      How can I make a Call to a DataSource without using Weblogic (weblogic.InitialContext) ? I need to use a generic InitialContext, like I do in the following code :

     //get naming context
          Context ctx = new InitialContext();

          //look up jndi name
          Object ref = ctx.lookup("Conexao_Oracle");

          //cast to Home interface
          conexao_OracleHome = (Conexao_OracleHome) PortableRemoteObject.narrow(ref, Conexao_OracleHome.class);

    TIA
    Felipe Soares

    PS : Any code samples could be very usefull

  5. Samples EJB with JDBC[ Go to top ]

    DataSource ds = (DataSource)ic.lookup("java:comp/env/myDatasource");//map myDatasource in your ejb-jar.xml to some name and map the name to a physical resource in weblogicejb-jar.xml(or any other xml if using any other server)

    After u get a datasource, u can get a connection from it as
    ds.getConnection();
    and then carry on as usual
  6. Samples EJB with JDBC[ Go to top ]

    WebLogic examples for EJB is at:
    http://www.weblogic.com/docs51/examples/ejb/Package-examples.ejb.html