1 Reply Latest reply on Feb 18, 2002 1:48 PM by jbossobj

    DataSource

    jbossobj

      Hello,

      I have embarked on the great journey of J2EE.
      Being a MSFT Freelancer developer, the switch over is not that easy. So I request of you, your time and patience with my questions!

      I have setup JBoss 2.4.4 with Tomcat 4.0.1 along with MySQL 3.23.47 and mm.mysql 2.0.11 running on Win2K SP2.

      From reading many of the posts I believe that the JDBC driver is setup properly.

      My problem is really simple but I can't get it (that is the story of my life, the hard things are easy but the easy things are hard). I'm trying to build my BMP Entity and I get a cannot resolve symbol. Here is the code (from Mastering EJB 2.0):

      import java.sql.*;
      import javax.naming.*;
      import javax.ejb.*;
      import java.util.*;

      public class AccountBean implements EntityBean {
      ...
       public Connection getConnection() throws Exception {
         try {
           Context ctx = new InitialContext();
           javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/ejbPool");
           return ds.getConnection();
         }
         catch (Exception e) {
           System.err.println("Could not locate datasource! Reason:");
           e.printStackTrace();
           throw e;
         }
       }
      }

      I have the mm.mysql 2.0.11.jar in the JAVA_HOME\jre\lib\ext as well as this entry in the classpath.

      I'm really excited about my journey, but every time I forward there is a mountain to climb as the next step. Imagine the questions I'll have concerning Pooling and CMP!!! :)

      TIA,
      Glenn.