your first way is more portable than the second and conforms to J2EE standards.

If you are using the second one and in future want to change the connection to a different pool or change the environment( porting into a new machine) then you are forced to create the pool with the same name and cannot use the existing pool. If you want to use the existing pool you have to change the code.

If you are using the first just changing the weblogic-ejb-jar.xml will do.

TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations technology projects - with its network of technology-specific websites, events and online magazines.