I am using RDS and have one master database which I write to and two read replication databases
I am using tomcat jdbc and I connect to the database via
Now I need to connect to the second read replication database but don't want to define a third Resource, I want a single resource for reading which connects to the two databases
Below is the current config (context.xml in web app)
<Resource type="javax.sql.DataSource"
name="jdbc/iomdb"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://mydbinstance.blah:3306/mydb?user=user&password=p"
maxActive="4"/>
<Resource type="javax.sql.DataSource"
name="jdbc/iomdbread"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://readreplicaiom.ff.com:3306/mydb?user=user&password=p"
maxActive="4"/>
Is this possible?
Perhaps you could use MySQL Proxy to broker the requests to the two read instances invisibly to the application?