If you have a mirrored SQL cluster but it has no VIP (virtual IP), and you want to connect a DualShield server to the SQL cluster for the purpose of failover redundancy. How can it be achieved?

DualShield Authentication Server utilizes JDBC driver to connect to a SQL server. You can achieve it by adding both servers to the JDBC connection string.

The JDBC string is found in the file named "server.xml" located in the "c:\program files\deepnet dualshield\tomcat\conf" folder.

Let us look at an example below that connects to one MySQL server.

<Resource name="jdbc/DasDS" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" password="changeit" url="jdbc:mysql://localhost:3306/dualshield?useUnicode=true&amp;characterEncoding=UTF-8" username="root" maxActive="1000" type="javax.sql.DataSource" validationQuery="Select 1" maxWait="5000">

To support a failover cluster, you need to change the JDBC string to:

<Resource name="jdbc/DasDS" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" password="changeit" url="jdbc:mysql://localhost,192.168.124.201:3306/dualshield?useUnicode=true&amp;failOverReadOnly=false&amp;characterEncoding=UTF-8" username="root" maxActive="1000" validationQuery="Select 1" maxWait="5000" type="javax.sql.DataSource">

As you can see, we appended the second SQL server after the original one "localhost" separated with a comma, e.g. "localhost,192.168.124.201"

In addition, you also need to set the failover property:

failOverReadOnly=false

(its default value was true), otherwise you will get an error "connection is read-only. Queries leading to data modification are not allowed". MS SQL and ORACLE have similar failover settings in their JDBC connection strings.


In MS SQL, it is called "failoverPartner".  Please use the following connection string.

jdbc:sqlserver://ServerA:1433;DatabaseName=dualshield;SelectMethod=cursor;encrypt=true;trustServerCertificate=true;failoverPartner=ServerB:1433


References

https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-config-failover.html

https://learn.microsoft.com/en-us/sql/connect/jdbc/using-database-mirroring-jdbc?view=sql-server-ver16