Package com.weibo.jbinlog

Source Code of com.weibo.jbinlog.Parser

/**
*
*/
package com.weibo.jbinlog;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Properties;

import com.mysql.jdbc.LogEvent;
import com.mysql.jdbc.MysqlReplicationConn;

/**
* @author tangfulin
*
*/
public class Parser {

  /**
   * @param args
   * @throws IOException
   * @throws SQLException
   */
  public static void main(final String[] args) throws IOException,
      SQLException {
    final Properties info = new Properties();
    info.put("user", "root");
    info.put("password", "asdf1234");
    info.put("database", "test");

    final MysqlReplicationConn conn = new MysqlReplicationConn("localhost",
        3306, info);
    conn.setBinlogFilename("mysql-bin.000001");
    conn.setBinlogStartPos(106);
    conn.setSlaveId(127);

    conn.startReplicaCommand();

    while (true) {
      final LogEvent event = conn.getNext();
      System.out.println(event);
      if (event == LogEvent.ENUM_END_EVENT) {
        break;
      }
    }
  }
}
TOP

Related Classes of com.weibo.jbinlog.Parser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.