1 Reply Latest reply on Apr 17, 2005 6:52 AM by Darran Lofthouse

    EJB and mysql

    jose luis herrero Newbie

      Hi everybody

      Something is wrong in my JBOSS server.

      I've developed a program that uses a mySQL database as follows:

      public class C1Bean implements SessionBean {
      public int activate(){
      try {
      catch (Exception ex) {
      return ( -1);
      return (0);

      The imported library is : mysql-connector-java-3.1.7.bin.jar

      The program is deployed ok, but when the method is invoked, always returns -1.

      If the program is used locally, that is, calling this method locally (no Jboss), the program runs ok.

      Does JBOSS run Ok if a database connector is needed?. Do I need to add something else to the JBOSS configuration?


        • 1. Re: EJB and mysql
          Darran Lofthouse Master

          When programming using Java the exceptions contain a lot of information about what the problem is, instead of converting it to an int you should either rethrow the exception or at the very least log the details i.e. Message, exception classname and stack trace.

          Is there a reason why you are avoiding the connection pool mechanism provided by the application server i.e. You configure a pool of connections and the session bean uses JNDI to get a connection.