How to use connection pooling in Jboss

2019-07-24 04:18发布

问题:

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();