If the connection code is written in DAO. How will the app server do the connection pooling
In DAO we just fetch the connection. App. Server is responsible for creating & closing the connections etc.,
The connection pool is managed through the DataSource, not through the EJB class. So long as you retrieve the connection from the DataSource, pooling will work, whether you are calling the DataSource from your EJB class or from another class (such as a DAO).
If you want to take advantage of the connection pooling provided by the application server, you will need to:
1) lookup the javax.sql.DataSource object via JNDI
2) invoke DataSource.getConnection()