Following code can be used to create a JDBC Connection to MySQL cluster. Here, cluster contains two nodes as 192.168.2.23 & 192.168.2.24.
Class.forName("com.mysql.jdbc.Driver").newInstance();
url = "jdbc:mysql:loadbalance://
+ “192.168.2.23:3306,
192.168.2.24:3306/YourDataBaseName”
+
"?"
+ “user=YourUserName&password=YourPassword”
+
"&loadBalanceConnectionGroup=first&loadBalanceEnableJMX=false&autoReconnect=true";
DriverManager.getConnection(url);