Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails errors switching to second DB with TNS string as Datasource
    text
    copied!<p>I use a TNS string as url of my Grails Datasource, with two oracle DBs (ora01, ora02). It connects to the db service ok during normal operation. Here is the config:</p> <pre><code>dbString = "jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (LOAD_BALANCE = ON) (ADDRESS = (PROTOCOL = TCP)(HOST = ora01.foo)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = ora02.bar)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orastage)))" dataSource { pooled = true driverClassName = "oracle.jdbc.OracleDriver" username = foo password = bar url = dbString logSql = false } </code></pre> <p>When the DBAs switch off ora01 and restart ora02 as the active one, the Grails app doens't realise and throws JDBC errors:</p> <pre><code>2013-04-26 11:41:35,428 ERROR JDBCTransaction - JDBC commit failed java.sql.SQLRecoverableException: No more data to read from socket at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1142) at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191) at oracle.jdbc.driver.T4C7Ocommoncall.doOCOMMIT(T4C7Ocommoncall.java:75) at oracle.jdbc.driver.T4CConnection.doCommit(T4CConnection.java:565) at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:3851) at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:3857) at org.apache.commons.dbcp.DelegatingConnection.commit(DelegatingConnection.java:334) </code></pre> <p>Does my config look ok? I'm assuming Grails can take a TNS string as datasource URL as it connects ok before we try failing a db - is this correct? It's like the app is still trying to connect to the dead db and not trying the other node. Do I need to get Grails to do anything specific to switch to the now-working node?</p>
 

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