# Creating and Loading Database Tables for the Online Orders Demo

Warning: Perform this procedure using your actual database installation. Do not attempt to create the database tables on iCache.

To create the user account:

1. Start the SQL*Plus utility.

2. Log in to the database administrator account.

   By default, `system` and `manager` are the username and password for the database administrator, but you might have to ask your Oracle system administrator to create the user for you if you do not have the appropriate privileges.

3. In SQL*Plus, enter:

   create user BC4J identified by BC4J;
   On successful execution, SQL*Plus will respond with "User Created."

4. Next, enter:

   grant resource,connect to BC4J;
   On successful execution, SQL*Plus will respond with "Grant succeeded."
   Note that certain Java2 style permissions must be granted to users running business components in JServer. For example, the following SQL script grants these permissions to the user BC4J (note that BC4J must be uppercase):
   SET VERIFY OFF
   EXEC DBMS_JAVA.GRANT_PERMISSION('BC4J', 'SYS:java.util.PropertyPermission', '*', 'write');
   EXEC DBMS_JAVA.GRANT_PERMISSION('BC4J', 'SYS:java.util.PropertyPermission', '*', 'read');
   EXEC DBMS_JAVA.GRANT_PERMISSION('BC4J', 'SYS:java.lang.RuntimePermission', 'createClassLoader', null);
   EXEC DBMS_JAVA.GRANT_PERMISSION('BC4J', 'SYS:java.lang.RuntimePermission', 'setContextClassLoader', null);
   COMMIT;
   SET VERIFY ON
   EXIT;

To create and populate the database tables:

1. Again in SQL*Plus, connect to the newly created user account:

   connect BC4J/BC4J@localhost
   This assumes your database is you local machine. If it isn't, replace localhost with the name of your database.

2. Locate the file OnlineOrders.sql in the OracleHome/Apache/BC4J/samples/onlineorders/sql_install directory and execute a command in SQL*Plus similar to the following:

   @"C:/OracleHome/Apache/BC4J/samples/onlineorders/sql_install/OnlineOrders.sql"

3. To exit SQL*Plus, at the prompt enter: exit