[ Pobierz całość w formacie PDF ]
.Ensure that the two SQL scripts(database_schema_users.sql and database_schema_accounts.sql) and the Forethoughtproperties file (forethought.prp) are in this directory.Then execute the ScriptTool class withthe SQL script as the argument:209Building Java"! Enterprise Applications Volume I: Architecture/java/instantdb (bmclaugh)> java org.enhydra.instantdb.ScriptTooldatabase_schema_users.sqlEnhydra InstantDB - Version 3.20 beta 1The Initial Developer of the Original Code is Lutris Technologies Inc.Portions created by Lutris are Copyright (C) 1997-2000 LutrisTechnologies, Inc.All Rights Reserved.Connected to jdbc:idb:forethought.prpDriver InstantDB JDBC DriverVersion Version 3.20.Database forethought is shutting down.Database forethought shutdown complete.Note that you did not have to explicitly create the Forethought database; the directory andproperties file provide the only required information needed, and then scripts can be executedagainst that database.Now, execute the same command for the accounts script(database_schema_accounts.sql), and you are ready to go.InstantDB also provides a tool forgraphical browsing of the database, the org.enhydra.instantdb.DBBrowser class.Thisallows you to select a properties file (forethought.prp in our case) and then browse thedatabase structure.Once you move through Chapter 5 and Chapter 7, you will need to follow the sameinstructions.Run the ScriptTool on the database_schema_keys.sql script to create theprimary key value table, and the database_schema_createTypes.sql script to create the typedata.B.3 MySQLTo use MySQL, download the package from http://www.mysql.org/ and install it.I've got amysql user with access to the scripts, and the /usr/local/mysql/bin directory in that user's path.I've also set my root MySQL user's password to a non-empty password; you should do thistoo, with the command mysqladmin -u root password [new password].You can thencreate the Forethought database with the following command:[localhost:~] mysql% mysqladmin -u root -p create forethoughtEnter password:You won't get any visible output, but don't be concerned; this does create the database.You'renow ready to connect to the database and run the SQL scripts.Use the mysql command forthis, as shown:[localhost:~] mysql% mysql -u root -p forethoughtEnter password:Welcome to the MySQL monitor.Commands end with ; or \g.Your MySQL connection id is 16 to server version: 3.23.37Type 'help;' or '\h' for help.Type '\c' to clear the buffermysql> source database_schema_users.sqlQuery OK, 0 rows affected (0.00 sec)210Building Java"! Enterprise Applications Volume I: ArchitectureQuery OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 1 row affected (0.01 sec)mysql> source database_schema_accounts.sqlQuery OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.01 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.01 sec)mysql> exitByeIn the same manner, you can use the source command to execute the keys script, the datatypes script, and the script that drops tables.In my example, the scripts are in the samedirectory that I ran the mysql command from; you'll need to modify the path to the script ifthis isn't the case in your setup.B.4 OracleUnlike many of the databases in this appendix, particularly the Java-based ones such asInstantDB and Cloudscape, creating a new database with Oracle is not such a trivial matter.Infact, entire books have been written about configuration and maintenance of Oracle databases!So in this section, the assumption is made that the database has already been created and setup.The global name of the database is ftht.middleearth.com ("ftht" instead of "forethought"because there is an eight-character limit on global names, and "middleearth.com" because it'smy home network's domain), and the SID is FTHT.Other than these basic parameters,specific configuration items like rollback sizes and TEMP tablespaces are left to you or yourDBA.Additionally, the examples shown assume that a user has been created in the database, withthe username "forethought" and the password "forethought".This user (for simplicity's sake)has been given the role DBA.This makes connecting, creating tables, and other administrativeduties possible without explicitly granting many permissions (like CREATE SESSION,ALTER ANY TABLE, etc.) [ Pobierz całość w formacie PDF ]