I am supposed to use JBoss connection pooling for my application.Right now I don't have any idea about that. I Googled but couldn't get any good link.
Can you please share any good link which describes how to define data source, create and use connections in Java ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Probably this is what you r looking for: http://www.coderanch.com/t/89511/JBoss/Connection-Pooling
This snippet returns the database connection as declared in the xml fragment:
InitialContext jndiCntx = new InitialContext();
DataSource ds = (DataSource)jndiCntx.lookup("java:/yourdsname");
connection = ds.getConnection();