Note that there are some explanatory texts on larger screens.

plurals
  1. POConnect to a Read Only database
    primarykey
    data
    text
    <p>While trying to connect to a database that's set to read only, the connection cannot be made. I get the following error:</p> <pre><code>Cannot create PoolableConnectionFactory (Io exception: The Network Adapter could not establish the connection) </code></pre> <p>The application needs to run in read-write mode and then automatically handle the switch to read-only by only checking the isReadOnly property of the connection object. The application runs correctly when connecting to a read-write database, but fails when I change to the connection string below (with security information removed). I've verified that the connection string is correct, so the problem doesn't lie there.</p> <pre><code>ca.businesssolutions.nbs.jdbc.connect=jdbc:oracle:thin:unicorn_read_only/password@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=9999)))(CONNECT_DATA=(SID=SBSBTST)(SERVER=DEDICATED))) </code></pre> <p>I'm having trouble trying to figure out where to start looking. I inherited the application and am not sure if it's a spring framework limitation or another setting I'm missing.</p> <p>The spring configuration for the datasource is:</p> <pre><code>&lt;bean id="dataSource" class="ca.businesssolutions.nbs.server.base.datasource.MyBasicDataSource" destroy-method="close"&gt; &lt;!--url and driver class name are set through Configuratoin object.--&gt; &lt;property name="initialSize" value="10"/&gt; &lt;property name="maxActive" value="-1"/&gt; &lt;property name="validationQuery" value="SELECT 1 FROM DUAL"/&gt; &lt;property name="accessToUnderlyingConnectionAllowed" value="true"/&gt; &lt;/bean&gt; </code></pre> <p>The Data Source constructor:</p> <pre><code>public MyBasicDataSource() { super(); setUrl(Configuration.get(Configuration.CONNECT)); setDriverClassName(Configuration.get(Configuration.DRIVER_NAME)); //The initial number of connections that are created when the pool is started. int numConnections = 10; try { numConnections = Integer.parseInt(Configuration.get(Configuration.NUMBER_OF_CONNECTIONS)); } catch (Exception exception) { // Do nothing. } setInitialSize(numConnections); //The maximum number of active connections that can be allocated from this pool at the same time, or non-positive for no limit. setMaxActive(-1); setValidationQuery("SELECT 1 FROM DUAL"); setAccessToUnderlyingConnectionAllowed(true); DataAccessObject.setDataSource(this); } </code></pre> <p>What else would help?</p>
    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.
 

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