5 Replies Latest reply on Sep 20, 2004 6:57 AM by kabirkhan

    Connection Pooling

    devloch

      I need some help with connection pooling for MS SQLSERVER2000. These are the steps I have followed:

      1) I have copied the mssql-db.xml file to the server/default/deploy folder.

      2) All drivers(jar files) are copied to the lib folder.

      3) This is the code I am using to use the connection pool.
      InitialContext ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("java:comp/env/MSSQLDS");
      Connection conn = null;
      Statement stmt = null;

      try {
      conn = ds.getConnection();
      stmt = conn.createStatement();

      I get the following error : org.apache.jasper.JasperException: MSSQLDS not bound

      Please Help........

        • 1. Re: Connection Pooling
          raja05

          What version of JBoss are u using?

          I suppose the datasource definition file has to end with
          -service.xml in 3.0.x and -ds.xml in 3.2.x

          Im not very confident about 3.2.x but if its 3.0.x, it should end with -service.xml and not -db.xml

          • 2. Re: Connection Pooling

            Do you have the resource reference mapping for the private ENC java:comp/env/MSSQLDS in your deployment descriptors?

            -- Juha

            • 3. Re: Connection Pooling
              tnevolin

              Hello devloch.
              I'm also trying to connect to MSSQL. The code is:

              InitialContext context = new InitialContext();
              ds = (DataSource) context.lookup("MSSQLDS");

              And it gives a NamingException. I think it cannot find it.

              In my mssql-ds.xml it is defined as simple
              <jndi-name>MSSQLDS</jndi-name>

              Is it important to use "java:comp/env/" prefix when call contex.lookup?

              • 4. Re: Connection Pooling
                darranl

                Have a look at the JNDI View in jmx-console to see what is actually bound.

                • 5. Re: Connection Pooling
                  kabirkhan

                  Try
                  java:/MSSQLDS