Hi Craig,

I tried the first example (servlet.findDataSource(null);) but get the following
error when compiling
my source:

"LogonAction.java": Error #: 314 : cannot access class javax.sql.DataSource;
neither class nor source found for javax.sql.DataSource at line 75, column 13

Can you please tell me where to find the needed package?

Thank you.

Regards,

Michael Brohl





|--------+----------------------->
|        |          "Craig R.    |
|        |          McClanahan"  |
|        |          <craigmcc@apa|
|        |          che.org>     |
|        |                       |
|        |          29.03.2001   |
|        |          05:40        |
|        |          Bitte        |
|        |          antworten an |
|        |          struts-user  |
|        |                       |
|--------+----------------------->
  >----------------------------------------------------------------------------|
  |                                                                            |
  |       An:     [EMAIL PROTECTED]                               |
  |       Kopie:  (Blindkopie: Michael Brohl/Lynx/DE)                          |
  |       Thema:  Re: Pooling with Oracle database                             |
  >----------------------------------------------------------------------------|







On Wed, 28 Mar 2001, Rafal Zakrzewski wrote:

> Hello,
>
> How to encode one pool of connections for whole application ?
> Should I encode this in some main servlet and then receive connection
> from this servlet ?
>
> In struts-config.xml I have a section:
>     <data-sources>
>     <data-source autoCommit="false"
>        description="Trial access to database"
>         driverClass="oracle.jdbc.driver.OracleDriver"
>         maxCount="4"
>         minCount="2"
>         password="123"
>              url="jdbc:oracle:thin:@ado:1521:123"
>              user="123" />
>
>   </data-sources>
>
>
> tnx
>

With this entry in struts-config.xml, Struts will create a single
connection pool, and will also make it available in different ways:

* If you have a reference to the controller servlet (as in an Action),
  you can call servlet.findDataSource(null);

* If you have access to the servlet context (as in a different servlet
  in the same webapp), you can call
  getServletContext().getAttribute(Action.DATA_SOURCE_KEY);

* In a custom tag implementation class, you can call
  pageContext.getAttribute(Action.DATA_SOURCE_KEY,
   PageContext.APPLICATION_SCOPE);

* In a scriptlet embedded in a JSP page, you can call
  application.getAttribute(Action.DATA_SOURCE_KEY);

In all of these cases you are referencing exactly the same connection
pool.

Craig




Reply via email to