Package org.h2.tools

Class CreateCluster


  • public class CreateCluster
    extends Tool
    Creates a cluster from a stand-alone database. Copies a database to another location if required.
    • Field Summary

      • Fields inherited from class org.h2.util.Tool

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      CreateCluster()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(java.lang.String urlSource, java.lang.String urlTarget, java.lang.String user, java.lang.String password, java.lang.String serverList)
      Creates a cluster.
      static void main​(java.lang.String... args)
      Options are case sensitive.
      private static void performTransfer​(java.sql.Statement statSource, java.lang.String urlTarget, java.lang.String user, java.lang.String password, java.lang.String serverList)  
      private static void process​(java.lang.String urlSource, java.lang.String urlTarget, java.lang.String user, java.lang.String password, java.lang.String serverList)  
      void runTool​(java.lang.String... args)
      Run the tool with the given output stream and arguments.
      private static java.util.concurrent.Future<?> startWriter​(java.io.PipedReader pipeReader, java.sql.Statement statSource)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CreateCluster

        public CreateCluster()
    • Method Detail

      • main

        public static void main​(java.lang.String... args)
                         throws java.sql.SQLException
        Options are case sensitive.
        Supported options
        [-help] or [-?] Print the list of options
        [-urlSource "<url>"] The database URL of the source database (jdbc:h2:...)
        [-urlTarget "<url>"] The database URL of the target database (jdbc:h2:...)
        [-user <user>] The user name (default: sa)
        [-password <pwd>] The password
        [-serverList <list>] The comma separated list of host names or IP addresses
        Parameters:
        args - the command line arguments
        Throws:
        java.sql.SQLException - on failure
      • runTool

        public void runTool​(java.lang.String... args)
                     throws java.sql.SQLException
        Description copied from class: Tool
        Run the tool with the given output stream and arguments.
        Specified by:
        runTool in class Tool
        Parameters:
        args - the argument list
        Throws:
        java.sql.SQLException - on failure
      • execute

        public void execute​(java.lang.String urlSource,
                            java.lang.String urlTarget,
                            java.lang.String user,
                            java.lang.String password,
                            java.lang.String serverList)
                     throws java.sql.SQLException
        Creates a cluster.
        Parameters:
        urlSource - the database URL of the original database
        urlTarget - the database URL of the copy
        user - the user name
        password - the password
        serverList - the server list
        Throws:
        java.sql.SQLException - on failure
      • process

        private static void process​(java.lang.String urlSource,
                                    java.lang.String urlTarget,
                                    java.lang.String user,
                                    java.lang.String password,
                                    java.lang.String serverList)
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • performTransfer

        private static void performTransfer​(java.sql.Statement statSource,
                                            java.lang.String urlTarget,
                                            java.lang.String user,
                                            java.lang.String password,
                                            java.lang.String serverList)
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • startWriter

        private static java.util.concurrent.Future<?> startWriter​(java.io.PipedReader pipeReader,
                                                                  java.sql.Statement statSource)
                                                           throws java.io.IOException
        Throws:
        java.io.IOException