All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.firebirdsql.management.FBCommandLine Maven / Gradle / Ivy

There is a newer version: 4.0.10.java7
Show newest version
/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package org.firebirdsql.management;

/**
 * FBCommandLine.java
 * 
 * 
 * Created: Thu Oct 10 14:14:07 2002
 * 
 * @author David Jencks 
 */

public class FBCommandLine {
    public FBCommandLine() {

    }

    public static void main(String[] args) throws Exception {
        if (args.length != 6) {
            usage();
            return;
        } // end of if ()
        if (!(args[2].equals("-user") || args[2].equals("-u"))) {
            usage();
            return;
        }
        if (!(args[4].equals("-password") || args[4].equals("-p"))) {
            usage();
            return;
        }
        String filename = args[1];
        String user = args[3];
        String password = args[5];
        FBManager fbm = new FBManager();
        System.out.println("filename: " + filename + ", user: " + user
                + ", password: " + password);
        fbm.start();
        if (args[0].equals("-create") || args[0].equals("-c")) {
            fbm.createDatabase(filename, user, password);
            return;
        } // end of if ()
        if (args[0].equals("-drop") || args[0].equals("-d")) {
            fbm.dropDatabase(filename, user, password);
            return;
        }
        usage();

    } // end of main()

    private static void usage() {
        System.out.println("Firebird driver command line db create/drop tool");
        System.out
                .println("This works only on localhost. Use filename rather than jdbc url.");
        System.out.println("create:");
        System.out
                .println("     -create  -user  -password ");
        System.out.println("drop:");
        System.out.println("     -drop ");
        System.out.println("flags -create may be abbreviated as -c, etc.");
    }

}// FBCommandLine




© 2015 - 2024 Weber Informatics LLC | Privacy Policy