Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Personally, try to avoid specify locations. I think best thing for you is to use JNDI to achieve this.</p> <p>In tomcat/conf/server.xml</p> <pre><code>&lt;Resource name="jdbc/prod" auth="Container" type="javax.sql.DataSource" driverClassName="${database.driverClassName}" url="${database.url}" username="${database.username}" password="${database.password}" maxActive="20" maxIdle="10" maxWait="-1"/&gt; </code></pre> <p>and In tomcat catalina.properties (If using Oracle XE otherwise change it accordingly):</p> <pre><code>database.driverClassName=oracle.jdbc.driver.OracleDriver database.url=jdbc:oracle:thin:@//localhost:1521/XE database.username=user database.password=password </code></pre> <p>In your application create properties file in your classpath named jdbc.properties and put followings (If using Oracle XE otherwise change it accordingly)</p> <pre><code>jdbc.driverClassName=oracle.jdbc.driver.OracleDriver jdbc.url=jdbc:oracle:thin:user/password@//localhost:1521/XE </code></pre> <p>then In Spring applicationContext.xml</p> <pre><code>&lt;context:property-placeholder location="classpath:jdbc.properties" /&gt; &lt;bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiName" value="java:comp/env/jdbc/prod" /&gt; &lt;property name="defaultObject" ref="dataSourceFallback" /&gt; &lt;/bean&gt; </code></pre> <pre><code>&lt;bean id="dataSourceFallback" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt; &lt;property name="url" value="${jdbc.url}" /&gt; &lt;property name="poolPreparedStatements"&gt; &lt;value&gt;true&lt;/value&gt; &lt;/property&gt; &lt;property name="maxActive"&gt; &lt;value&gt;4&lt;/value&gt; &lt;/property&gt; &lt;property name="maxIdle"&gt; &lt;value&gt;1&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload