MySQL Forums
Forum List  »  Utilities

MySQL fabric(1.5.5) with connector J
Posted by: PIYUSH MALHOTRA
Date: December 12, 2018 11:35PM

I am a newbie in MySQL Fabrics and trying to create the HA clusters for own understanding. I have downloaded the MySQL-Utilities 1.5.5 and python 27 to run fabrics. Below command used :

shell > python mysqlfabric.py manage start



Using this command, I was able to see that fabric server has been started and it had created a database for storing the fabrics related information.


Now, instead of using MySQL connection, we need to use the fabrics connection to interact with Fabric server who would communicate with the primary server(servers added in the group) to perform MySQL operations. Following is the sample code used:

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import com.mysql.fabric.jdbc.JDBC4FabricMySQLConnection;
public class fabrics {

JDBC4FabricMySQLConnection connection;

public static void main(String [] args) throws SQLException {
fabrics f = new fabrics();
f.connection = (JDBC4FabricMySQLConnection)DriverManager.getConnection("jdbc:mysql:fabric://"
+ "localhost:32274/employee?fabricUsername=admin&fabricPassword=tropos", "root", "tropos123");
f.connection.setServerGroupName("piyush");
f.connection.addQueryTable("employees");
PreparedStatement stmt = f.connection.prepareStatement("select * from employees");
stmt.executeQuery();
stmt.close();
f.connection.close();

}
}

While debugging, I was able to obtain the connection but while executing the query nothing happens, means it never returns, and I don't see any exception coming on the console; nothing also happens on MySQL fabrics server.
Anyone ever has stuck in this situation would be very helpful. Indeed help would be much appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL fabric(1.5.5) with connector J
1225
December 12, 2018 11:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.