You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bradley G Smith <bg...@fs.fed.us> on 2002/12/16 22:01:56 UTC

Oracle DataSource Tips

Since it took me several hours to catch this bug, I thought I might pass it
along to anyone using Oracle as a datasource for the Struts application.

The OracleDatSource and OraclePooledConnectionDataSource classes use
standard Bean naming conventions for getters and setters. The url property,
however, uses setURL and getURL for the setter and getter respectively.
Therefore, the set-property element in the datasource clause should be
<set-property property="URL" value="jdbc:oracle: ..." /> instead of
<set-property property="url" value="jdbc:oracle: ..." />.

A valid datasource definition that is working for me is:

<data-sources>
   <data-source key="DB_KEY"
                              type
="oracle.jdbc.pool.OracleConnectionPoolDataSource">
      <set-property property="password"
                                 value="valid_pass" />
      <set-property property="user"
                                 value="valid_user" />
      <set-property property="description"
                                 value="Application Data Resource" />
      <set-property property="URL"
                                  value="jdbc:oracle:thin:
@xxx.xxx.xxx.xxx:1521:a" />
   <data-source>
</data-sources>

The xxx.xxx.xxx.xxx value is an IP or resolvable hostname for the oracle
server. 1521 is the port to use. "a" is the instance name for the database.
The key is an arbitrary string.

If you choose instead to use the default connection pool from Struts (via
the Commons database package) then the ping that works for Oracle is
"select 1 from dual". Dual is a virtual table in every Oracle instance.

Brad



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Oracle DataSource Tips

Posted by Mark <ma...@libero.it>.
Hello

I'm using oracle as my datsource as well, I haven't had this problem but
that in my earlier posting..

So who do you reference the datasource specifed in config.xml in business
logic classes. The docs recommend this seperation but provide no clear way
of doing this, am i missing something?

Many thanks mark

On 16-12-2002 22:01, "Bradley G Smith" <bg...@fs.fed.us> wrote:

> Since it took me several hours to catch this bug, I thought I might pass it
> along to anyone using Oracle as a datasource for the Struts application.
> 
> The OracleDatSource and OraclePooledConnectionDataSource classes use
> standard Bean naming conventions for getters and setters. The url property,
> however, uses setURL and getURL for the setter and getter respectively.
> Therefore, the set-property element in the datasource clause should be
> <set-property property="URL" value="jdbc:oracle: ..." /> instead of
> <set-property property="url" value="jdbc:oracle: ..." />.
> 
> A valid datasource definition that is working for me is:
> 
> <data-sources>
>  <data-source key="DB_KEY"
>                             type
> ="oracle.jdbc.pool.OracleConnectionPoolDataSource">
>     <set-property property="password"
>                                value="valid_pass" />
>     <set-property property="user"
>                                value="valid_user" />
>     <set-property property="description"
>                                value="Application Data Resource" />
>     <set-property property="URL"
>                                 value="jdbc:oracle:thin:
> @xxx.xxx.xxx.xxx:1521:a" />
>  <data-source>
> </data-sources>
> 
> The xxx.xxx.xxx.xxx value is an IP or resolvable hostname for the oracle
> server. 1521 is the port to use. "a" is the instance name for the database.
> The key is an arbitrary string.
> 
> If you choose instead to use the default connection pool from Struts (via
> the Commons database package) then the ping that works for Oracle is
> "select 1 from dual". Dual is a virtual table in every Oracle instance.
> 
> Brad
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>