Please try to look at the NetBeans IDE Help topic 'Servers and Databases > Servers > JBoss Application Server > Setting Up a Connection Pool ...'
It talks about PointBase database server but it can be understood generally.
Following steps must be done (basically):
1. create a data source (DS) pointing to your database
2. place a database driver into JBoss
3. tell your web/ejb module what DS it should use
There are other things like mapping entity beans to the DB tables, fields to columns etc.
NetBeans does not support generation of the JBoss-specific deployment descriptors, except some basic settings in jboss-web.xml, thus you must edit it yourself.
On the other hand you can use NetBeans to generate the CMP entity beans from a database.