File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(Application scoped) DB connection pooling

 
Bojan Tomic
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get connection pooling in JBoss 4.2.2, and for that purpose, I've been reading some JBoss docs. Now, one thing confuses me, is it possible to get connection pooling without modifying JBoss' configs (so that it affects all application), but instead configure pooling for a single application only (like you do in Tomcat with context.xml)?
My goal is to be able to give the application to someone without making them reconfigure their server.
Since this is easily doable in Tomcat, I presumed it's doable in JBoss, but I can't seem to find a way to do it.

In case it is needed, here's my META-INF/context.xml from Tomcat deployment


and my resource related poriton of WEB-INF/web.xml


I tried deploying to JBoss without any changes, but got a NamingException as jdbc/mysql was never properly bound.
I am new to JBoss so I might have said some nonsense. In that case, please bear with me and tell me what I have got wrong.

Thanks for the time.
[ October 17, 2008: Message edited by: Veggen Skrikk ]
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you are talking about database connection pooling (and not HTTP connection pooling). If so, this is easy to do. The connection pool is defined in the *-ds.xml file. You can provide this file with your application (you can even embed the *-ds.xml file in your EAR), and you can have all of your applications use the same *-ds.xml-defined data source.

Look at docs/examples/jca for example *-ds.xml files for a variety of databases.
 
Bojan Tomic
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Peter for this answer. Just one more thing, if it's not a problem; where should I place *-ds.xml (inside EAR) for JBoss to find it? Can I do this with WARs as well?

Thanks again for your time.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For an EAR, place the *-ds.xml in the base directory. You must then also provide a META-INF/jboss-app.xml file containing:



Unfortunately, this will not work in a WAR file. But you could have an EAR with the *-ds.xml and WAR.
 
Bojan Tomic
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks a lot for the tip. I'll see what I can do.
Btw. I can't wait for your book to come out. I'm in desperate need of a good JBoss guide.
[ October 17, 2008: Message edited by: Veggen Skrikk ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic