def METHOD_NAME(cls, cmd, resource_group_name, name, environment, connection_name="default",
                     db_connection=None):
    management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
    api_version = API_VERSION
    sub_id = get_subscription_id(cmd.cli_ctx)
    if environment:
        url_fmt = ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/staticsites/{}/builds/{}"
                   "/databaseConnections/{}?api-version={}")
        request_url = url_fmt.format(
            management_hostname.strip('/'),
            sub_id,
            resource_group_name,
            name,
            environment,
            connection_name,
            api_version)
    else:
        url_fmt = ("{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Web/staticsites/{}"
                   "/databaseConnections/{}?api-version={}")
        request_url = url_fmt.format(
            management_hostname.strip('/'),
            sub_id,
            resource_group_name,
            name,
            connection_name,
            api_version)
    r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(db_connection))
    return r.json()