AO Logo
 
  
  
  
Add Database
Add User
AO
AO Industries, Inc.
Application Infrastructure ProviderApplication Infrastructure Provider
Sign UpWhat's NewClient AreaContact UsSite Map
 
your location:   home page ··· aoserv platform ··· software components ··· aoserv client ··· how to ··· mysql howto ··· add mysql database
Adding a MySQL Database

AOSH Commands
add_mysql_database database_name server package

Simple API
/**
 * Adds a MySQLDatabase to a Server
 *
 * @param  aoClient     the SimpleAOClient to use
 * @param  name         the name of the database to add
 * @param  server       the hostname of the server to add the database to
 * @param  packageName  the name of the Package that owns the new database
 */
public static void addMySQLDatabase(
    SimpleAOClient aoClient,
    String name,
    String server,
    String packageName
) throws IOException, SQLException {
    aoClient.addMySQLDatabase(name, server, packageName);
}

Full API
/**
 * Adds a MySQLDatabase to a Server
 *
 * @param  aoClient  the SimpleAOClient to use
 * @param  name  the name of the database to add
 * @param  server  the hostname of the server to add the database to
 * @param  packageName  the name of the Package that owns the new database
 *
 * @return  the new MySQLDatabase
 */
public static MySQLDatabase addMySQLDatabase(
    AOServConnector conn,
    String name,
    String server,
    String packageName
) throws IOException, SQLException {

    // Resolve the Server
    Server se=conn.getServerTable().getServer(server);

    // Resolve the Package
    Package pk=conn.getPackageTable().getPackage(packageName);

    // Add the MySQLDatabase
    int mdPKey=se.addMySQLDatabase(name, pk);
    MySQLDatabase md=conn.getMySQLDatabaseTable().getMySQLDatabase(mdPKey);

    // Return the object
    return md;
}
Copyright © 2000-2024 AO Industries, Inc.