you have a portlet repository, hear
http://labs.jboss.com/portal/index.html?
ctrl:id=page.default.downloads&project=portletswap&category=.portlets
they can be deployed on the jboss portal, you can check the src, i
think they have a webservice portlet thair to.
for database connection you can use connection poling that are
provided from the application server.