1 Reply Latest reply on Sep 10, 2002 11:02 AM by petertje

    problem about sqlserver

      my environment is sql-server 2000 + jboss3.0.1
      i use a bmp entity bean named CookBook,it throw exception when get the second connection.

      java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.
      the jboss.xml is created by the ejx,like this

      <?xml version="1.0" encoding="GBK"?>


      false
      <container-configurations />
      <resource-managers>
      <resource-manager>
      <res-name>MSSQLDS_REF</res-name>
      <res-jndi-name>java:/MSSQLDS</res-jndi-name>
      </resource-manager>
      </resource-managers>
      <enterprise-beans>

      <ejb-name>Menu</ejb-name>
      <jndi-name>Menu</jndi-name>
      <configuration-name>Standard Stateful SessionBean</configuration-name>
      <ejb-ref>
      <ejb-ref-name>ejb/Kitchen</ejb-ref-name>
      <jndi-name>Kitchen</jndi-name>
      </ejb-ref>


      <ejb-name>Kitchen</ejb-name>
      <jndi-name>Kitchen</jndi-name>
      <configuration-name>Standard Stateless SessionBean</configuration-name>
      <ejb-ref>
      <ejb-ref-name>ejb/CookBook</ejb-ref-name>
      <jndi-name>CookBook</jndi-name>
      </ejb-ref>
      <ejb-ref>
      <ejb-ref-name>ejb/Larder</ejb-ref-name>
      <jndi-name>Larder</jndi-name>
      </ejb-ref>


      <ejb-name>CookBook</ejb-name>
      <jndi-name>CookBook</jndi-name>
      <configuration-name>Standard BMP EntityBean</configuration-name>
      <resource-ref>
      <res-ref-name>jdbc/recipeJDBC</res-ref-name>
      <resource-name>MSSQLDS_REF</resource-name>
      </resource-ref>


      <ejb-name>Larder</ejb-name>
      <jndi-name>Larder</jndi-name>
      <configuration-name>Standard CMP EntityBean</configuration-name>

      </enterprise-beans>


      the code in the CookBookEJB to get datasource is

      /**
      * Gets the datasource to the db
      */
      private Connection getConnection() {
      try{
      Context initial = new InitialContext ();
      DataSource datasource = (DataSource) initial.lookup ("java:comp/env/jdbc/recipeJDBC");
      return datasource.getConnection ();
      } catch (javax.naming.NamingException ne) {
      ne.printStackTrace ();
      throw new EJBException (ne);
      } catch(SQLException sqle) {
      sqle.printStackTrace();
      throw new EJBException (sqle);
      }
      }


      i think the jboss.xml is wrong because the cmp entity bean is ok with another way

      please help me ,thanks