This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

DAOs and Datasources  RSS feed

Hussein Baghdadi
clojure forum advocate
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I want to use DAO pattern in EJB and servlets components.
I know how to implement DAO, but I am not sure if I can use datasource or connection pools inside DAOs.
to use a datasource in EJBs or Servlets, we add a datasource to the container , then we add some entries to ejb-jar.xml or web.xml files, then use JNDI.
but how to use a datasource inside a DAO ?
just use the normal code like :
Context ctx = new InitialContext( );
DataSource ds = (DataSource)ctx.lookup("java:com/env/jdbc/ToddDB");
its work ??
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!