Java Reference
In-Depth Information
}
catch (Exception ex) { // ignore }
}
}
public static void main(String[] args) {
UserManager userMgr = new UserManager ();
// Create a user
userMgr.createUser("john", "j23xqt3#");
// Drop the user
userMgr.deleteUser("john");
}
}
Altering a user
The ALTER USER commands are useful for changing the permissions for a user, the password
assigned to the user, or the expiration date for the user. If the user does not exist, you will get a similar
error message as you will get if you try to delete a user that does not exist. The following command
shows examples of what you can do with the ALTER USER command.
ALTER USER user_name WITH PASSWORD 'hu8jmn3'
ALTER USER user_name VALID UNTIL 'Jan 31 2030'
ALTER USER user_name CREATEUSER CREATEDB
Understanding Database Schemas
A database schema defines the objects to be stored within the database. These objects generally are
tables that contain columns, indexes on these tables, views of tables, stored procedures and triggers,
and security instructions. Other objects such as synonyms, links, and sequences should also be part of
the schema, depending on whether they are implemented by the database vendor and used within the
database. A database schema also includes storage instructions for the objects that are often defaults
that go unnoticed.
A schema is a high-level abstraction of a container object that the SQL standard defines to contain other
database objects. In many database management systems, a schema is the same as the database
owner. In others, where a database can have multiple schemas, a schema denotes a collection of
objects a single user owns.
Schemas are a named entity and generally follow the dot-naming conventions (as for Java packages
and classes). Typically, schemas are named like this:
OWNER_NAME.OBJECT_NAME
You can create a schema and assign an owner to it. By default, if the user John Doe logs into the
database and creates a bunch of objects, all the objects created belong to John's schema. A super user
can create objects and assign them to be owned by other users.
The following is the general syntax for the CREATE SCHEMA command.
CREATE SCHEMA AUTHORIZATION authorization_name
create_oject_statement
[ create_object_statement ... ]
[ permission_statement ... ]
Search WWH ::




Custom Search