See sample source code section here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Ex:
Context ctx = new InitialContext();
      if(ctx == null )
          throw new Exception("Boom - No Context");

      DataSource ds =
            (DataSource)ctx.lookup(
               "java:comp/env/jdbc/TestDB");


Of course what you do with the data source depends on your DAO implementataion (iBatis, Hibrenate, etc.)


.V


hylepc wrote:
Hi,

From a Data Acess Object (DAO), I need to access a DataSource (like
getServletContext().getAttribute (Globals.DATA_SOURCE_KEY)). But, I don't
have access to the servlet variable.

What is the proper way to get the DataSource from a DAO which is called by
an Action but doesn't extend Action?

Thanks,

Will


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to