Accessing and Using oGRAC
Accessing oGRAC
Client tools for connecting to the database include ogsql and app interfaces (such as JDBC).
- ogsql is the client tool bundled with oGRAC. Using ogsql to connect to the database, you can interactively enter, edit, and execute SQL statements. For details, see ogsql Usage Instructions.
- Users can use standard database app interfaces (such as JDBC) to develop oGRAC-based apps. For details, see JDBC Guide.
Using oGRAC
The following describes the basic operations of using oGRAC. Through the following content, you can learn how to create a database, create tables, insert data into tables, and query data in tables.
Prerequisites
You have completed the installation of oGRAC.
Procedure
Log in to the primary database node as the installation user.
Connect to the database.
After the database installation is complete, the database starts by default. You can connect to this database for the first connection.
Run the following command to connect to the database:
shellogsql / as sysdbaAlternatively, run the following command to connect to the database:
shellogsql user_name/user_password@127.0.0.1:portA successful connection brings up the interactive interface..
Create a database user.
Run the following command to create a database user:
sqlcreate user user_name identified by 'user_password';If the following information is displayed, the creation is successful:
shellSucceed.Run the following command to set the user as a system administrator:
sqlgrant all to user_name;Create a table.
Run the following command to create a table named
mytablewith only one column. The column name isfirstcoland the column type is integer.sqlcreate table mytable (firstcol int);The following output indicates that the table has been created successfully:
shellSucceed.Run the following command to insert data into the table:
sqlinsert into mytable values (1);If the following information is displayed, the insertion is successful:
shell1 rows affected.Run the following command to query data in the table:
sqlselect * from mytable;The query result is as follows:
shellFIRSTCOL ------------ 1 1 rows fetched.