Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mysql in embedded tomcat - JNDI?

 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm migrating an app from stand-alone tomcat to jboss/tomcat.
I'm slowly getting to know JBoss and its configuration and deployment issues, but it's not easy finding the right docs and getting help. I've just given up on the JBoss.org forum, which the biggest newbie graveyard I've ever seen.
Anyway, if anyone can enlighten me on this issue, I'd appreciate it:
I've got a fair amount of code already running with struts in this app using JDBC in a tomcat JNDI resource connection pool. I can't find a way to set this up under jboss/tomcat.
Do I change over to using the xxxx-ds.xml, with a datasource pointing to mysql? That is a connection pool, right?
If not, where do I set up my existing commons.dbcp.BasicDatasourceFactory? The server.xml in /jbossweb-tomcat50.sar/ is obviously wrong, judging by the fact that it had no effect.
Thanks
Adam
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And do I need a resource-ref element in my webapp's web.xml for it?
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved this myself. For the sake of the archives, yes I did use a local-tx-datasource entry in my mysql-ds.xml file and it created a nice JBoss connection pool. And I didn't need a resource-ref in my web.xml.
 
John Myers
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you get the datasource in your servlet? through jndi?? I get name not bound.
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might still WANT a resource ref though, then you can access a local java:/comp/env/jdbc name rather than the global name. You don't have to, but I think it's a good idea in general to not hardcode lookups of global jndi names.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, that's right. Global JNDI. Norm, is that less efficient than calling it up via the local name?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic