2 Replies Latest reply on Jan 18, 2005 7:29 AM by vjy

    creating connection pool! please help me!

    Ramazan Pekin Newbie

      I want to connect to mysql db from the ejb. I have learned that I have to create a connection pool. I have looked but I cant find how it is being. first of all I want to explaing what I have done.


      Step 1: mysql-ds.xml
      a) Take the mysql-ds.xml file located in the [JBOSS_HOME]/docs/examples/jca folder and place it in the deploy folder.

      I have configured this xml file like this:



      b) Remove the hsqldb-ds.xml from the deploy folder and save it somewhere else.

      Step 2: ejb-deployer.xml
      Edit this file, which is located in the deploy folder.

      a) Find INTERVAL in the file and change this column name to something else. This is required because INTERVAL is a reserved word for MySQL 4.0. The symptom for not having fixed this is am error mentioning INTERVAL bigint when deploying an EJB.

      b) Find other in the file and change this type to text. This is required because type other does not exist in MySQL 4.0.

      Step 3: standardjaws.xml
      Edit this file, which is located in the conf folder of the server. Change the type-mapping of the datasource from Hypersonic SQL to mySQL Note that these names are case sensitive.

      Step 4: JMS configuration descriptors
      a) Remove hsqldb-jdbc2-service.xml from folder deploy/jms. Save this file somewhere else.

      b) Copy mysql-jdbc2-service.xml from folder docs/example/jms to deploy/jms.

      c) Edit mysql-jdbc2-service.xml and change the datasource name if applicable. In my configuration I don't use HSQL at all so I configured the default datasource DefaultDS for MySQL. In this file, change mySQLDS to DefaultDS. Note that datasource names are case sensitive.

      Step 5: Install MySQL Java Connector
      Download MySQL Connector/J and place the file mysql-connector-java-3.0.15-ga-bin.jar in the lib folder of the server.


      After all of these how can I connect to mysql from ejb, what I have to do? did I create a connection pool with this? please, please, please help me.

        • 1. Re: creating connection pool! please help me!
          Ramazan Pekin Newbie

          InitialContext ctx = new InitialContext();
          DataSource ds = (DataSource)ctx.lookup("jspNedirMysql");
          java.sql.Connection jspNedirCon = null;
          jspNedirCon = ds.getConnection();
          }catch(SQLException ex)
          }catch(NamingException ex)


          I have tried that and this error have been occured

          javax.naming.NameNotFoundException: jspNedirMysql not bound

          please help me.

          • 2. Re: creating connection pool! please help me!
            vjy Newbie

            Check this out


            SelectMethod=cursor takes care of the connection pooling. Experts correct me if I am wrong