Diary for Training Management Database 6-15-99: TMD will be installed on a single machine and will be accessed by other machines through a web browser. On the machine that will be acting as the server, I need to have the following: 1. The server machine must have Oracle. 2. I must have an Oracle account. 3. I must install a webserver, such as Java Webserver1.1.3 or Apache. 4. The server machine must have JKD 1.1.6. I'm now going to download Sun's webserver and install it under my account on the machine carver.npac.syr.edu. This is the database server and also has JDK. Yuping has given me an Oracle account, for which I need to do the following to use: 1. source ~oracle/.cshrc 2. sqlplus marlon/marlon The latter logs me in to the data base and I get the sql prompt. I think the form above means login_name/password. I also need to find out if the webserver is a free download for ASC. I've downloaded the java webserver software, but I've hit an impass. Java software typically doesn't need to be "installed" like C software because there is nothing to compile. Anyway, the problem is that the server is started by running httpd, which I can only do as myself, not superuser. Unfortunately, httpd is already being run on carver by root, and so I can't get access to the default ports (9090, for example). Need to find out how to get around this. I suppose this won't be a problem as ASC since the web service will be installed by the superuser and run as root. Incidently, I suppose the reason that the machine needs to have JDK 1.1.6 is so that the web server (which is written in Java) can be run by the local virtual machine. 6-16-99: OK, I have the JavaWebServer1.1.3 sitting in my home directory. I could start httpd on some machines (circe and the ospreys) but could not start it on carver. The reason is of course that httpd was already running on carver on port 8080, so I would have to change the port number and also the port number for the administration deamon. So--logged into osprey2 and started httpd (located in the JavaWebserver's bin directory). Then pointed my webbrowser to http://osprey2:9090 (I was working on luke at the time, so notice that I was administering this over the web). Logged on as admin and then by clicking around I changed the port for httpd to 6712 and the port for the admin tool to 9292. Exited the admin tool and killed httpd on osprey2. Then logged onto carver and started httpd on this machine. Everything now works becauce my own personal version of httpd is running on 6712 while the principal version runs on 8080. I also have access to my own personal admin tool on 9292. The main admin tool is accessed on 9090 (which I don't have a password for). Just a reminder that all the information about installing the sever and using the admin tool (and there's not a lot of it) can be found in the README file for JavaWebServer1.1.3. ************************************************************** * Instructions for installing * the Training Management Databas ************************************************************** 1. It is assumed that a machine has been set up to run both Oracle and a web server that supports servlets (such as JavaWebServer1.1.3). We'll also need the appropriate JDBC for the database that we are using (presumable Oracle 8). We'll call this machine , and it could have, for example, the name carver.npac.syr.edu. We will assume that JavaWebServer has been installed and is located in the directory . For example, it may be located under /npac/home/mpierce/JavaWebServer1.1.3/. 2. The following files are needed to run the Training Database: (a) admin.sql, table.sql, sequence.sql: SQL files for setting up the data tables and sequencing them. The admin.sql file provides the system with an initial administrator. The data, name, and password should be changed as soon as possible. These are provided in the release. (b) oracle.zip: Dynamically creates the html pages from the data in the tables. (c) Training.jar: Contains the java classes required to interact with the database. Provided in the release. (d) configure.txt: Some configuration information that is used by the jar file. Can be edited. Provided in the release. 3. Log onto the database and load the tables and sequences at the sql prompt: [dbServer> source ~oracle/.cshrc [dbServer> sqlplus marlon/marlon [sql> @tables.sql [sql> @sequence.sql [sql> @admin.sql The first two lines are executed by the unix shell. The three sql files must be executed in the order shown. 4. Modify the CLASSPATH variable in .cshrc to the following: CLASSPATH=.:/usr/npac/java/lib/classes.zip:/lib/class es111.zip:/lib/oracle.zip:/lib/jws. jar:/lib/javac.jar:/servlets/Traini ng.jar The file classes.zip should come with the JDK release. The files classes111.zip, jws.jar, and javac.jar should come with the JavaWebServer release. If the CLASSPATH variable is already set, you may want to change the following to CLASSPATH=<...all the above stuff...>:$CLASSPATH. 5. Place all files described in Section 2 in the appropriate directories, as given in the CLASSPATH list above; i.e. put Training.jar in /npac/home/mpierce/JavaWebServer1.1.3/servlets. The file configure.txt also goes in the servlets directory. 6. Reread the CLASSPATH shell variable: source ~/.cshrc. 7. Restart the httpd daemon. If you are using JavaWebServer, this can be done with the Admin Tool. 8. Move the gif images provided to /public_html/images. This location can be changed by modifying the config.txt file. 9. You can now access the Welcome page from a web browser: http:///servlets/ascdb.pub.WelcomePage ascdb.pub.WelcomePage is a servlet that is included in the Training.jar file. You may also wish to create a servlet alias for this file. If you are using JavaWebServer, start the admin tool, click the modify button, choose the option "servlet alias" and then choose "add". You can then alias the above servlet as "Training". The welcome page can then be accessed by a web browser at the web page http:///Training. Note the above assumes you are using port 80 for the httpd daemon. 10. To use the interface, it is first necessary to add entries for Country, State, and Surtitle to the Lookup Tables. These are needed in order to add classes and users. 11. IMPORTANT NOTE: JDBC connects with the data base through a Driver Manager (DM). The DM has a URL address like this jdbc:subprotocal://host:port/databasename so, for instance, on carver the above line is jdbc:oracle:thin@carver.npac.syr.edu:1521:europe. This will have to be changed to something appropriate for the ASC system. This line is given in the file configure.txt that is included with the distribution, as are other important text strings that might possibly need to be modified. 12. Note that the CLASSPATH must be set correctly, as described above, for the Java Webserver daemon httpd to be able to access the data base pages. In other words, if you want to use the machine carver.npac.syr.edu as the data base server, then if you start httpd on this machine as root, then root must have the proper $CLASSPATH as described above. Note that clients do not need to set their classpaths to use the database. ***Maybe I should write a java applet that updates the strings*** 6-17-99: On the agenda for today, I want to learn a little about SQL, JDBC, and servlets. Tomorrow, I'm supposed to meet with Nancy, so I want to at least have some idea of what kind of questions to ask. Ok, here're a few quick nuggets of wisdom. SQL is standard for most data bases. Vendors provide SQL interpreters which can execute language commands interactively. SQL commands can also be embedded in programs so that the data stored in the database can be retrieved, modified, etc., by some program written in a standard programming language (C, Perl, Java, etc.) The way the programming language interfaces with the database depends on the language. The Java interface is called JDBC. Yuping's files tables.sql, sequences.sql, etc provide examples of SQL commands. I notice that some of the commands have the constraint that they must be NOT NULL. This probably explains the "null" pages I got when I tried to use the TDM without required entries. Once and for all, API=Application Programming Interface. 6-21-99: Just a few more notes. The source code is stored in several directories under asc/db/source. The compiled classes are included under the directory asc/db/servlets/ascdb. Subdirectories include courses, classes, users, etc. All of the classes in a particular subdirectory are part of the same package. For instance, the file ascdb/courses/AgendaInput.class is part of the package ascdb.courses. In the source code, the file AgendaInput.java begins with the line "package ascdb.courses". This particular class must also use classes defined by ascdb/pub/UserCheck.java, so it imports them with the line "import ascdb.pub.UserCheck". All of the directory structure of the class files is archived under by the jar file Training.jar, as can be verified with the command "jar tf Training.jar". This file must be included in the CLASSPATH in order for the programs to work. In general, if you define a package, you must include the path to its top level directory in the CLASSPATH. I think I'm going to write a java program to implement the installation process. Can run as either a servlet or an application, but not an applet, since I will want to run some SQL commands. 6-23-99: I found out that for the source code to run correctly, the JavaWebServer must be running. I learned this after trying to get things to work using the Jigsaw server. One problem is that the file conf.java expects the configure.data file to be in a subdirectory called "servlets". For the JWS there is a file called JavaWebServer/servlets, the the equivalent directory for Jigsaw is Jigsaw/Jigsaw/WWW/servlet. The path has a different structure and the directory is named "servlet", not "servlet". This should be corrected. 7-12-99: Last notes. The source code for the TMD is located in /localb/oracle/usr/asc/db/source on carver. The class files can be found under /localb/oracle/usr/asc/db/servlets/ascdb.