0

Configure OracleDataSource in Struts

Following is the configuration to be defined in <data-sources> and </data-sources>

Things to be remember while defining the OracleDataSource in Struts are
  1. URL should be in uppercase otherwise it will throw following exception

    java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL

  2. username and password should be defined in URL string and not separate property. Otherwise it will throw following exception

    java.sql.SQLException: invalid arguments in call

<data-source type="oracle.jdbc.pool.OracleDataSource"
key="ods">
<set-property property="driverClassName"
value="oracle.jdbc.driver.OracleDriver" />
<set-property property="URL"
value="jdbc:oracle:thin:username/password@localhost:1521:dbname" />
<!--
Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<!--
Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<!--
Maximum time to wait for a dB connection to become available
in ms, in this example 5 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<set-property property="maxWait" value="5000" />
<set-property property="readOnly" value="true" />
<set-property property="autoCommit" value="false" />
</data-source>

|

0 Comments

Copyright © 2009 So That I Can Remember All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.