This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Switch over and JDBC connection

When I use JDBC connection and master host is down, how can I switch over to slave host?

I have two MadiaDB nodes "MyDB1" and "MyDB2" work in Master-Slave Standard replication mode. Outside there is a JDBC connection configuration, that enables one application to access MyDB1

<connection-url>jdbc:mariadb://<ip of MyDB1>/testdb</connection-url>
<driver>mariadb</driver>
<security>
    <user-name>maria</user-name>
    <password>mariadb</password>
</security>

When MyDB1 is down(e.g. power off), without changing this url 1) Will this connection still work? 2) How can I set to auto switch over MyDB2?

Thanks in advance.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.