Web-Oriented Applications of Databases Laboratory
This experiment demonstrates the project’s laboratory scenario, distance experiments using Java technologies for accessing the VirtualElectroLab laboratories’ resources in an asynchronous mechanism. Another application determines the normalized forms of a relation that has a number of attributes. Using these dependencies, the application determines the first, second and third normalized form of the relation.
The laboratory demonstrates the use of a database system for asynchronous, remote and virtual using of experiments.
This laboratory includes two parts. The first demonstrates the usage of a database system by Java applets created for remote experiments. The second part shows a Java applet created for normalizing databases.
Part 1. Experimental laboratories using a database system to access data.
Asynchronous web based experiments
In order to split the synchronous functionality into three asynchronous steps, our Web Page Team has developed a more complex system, which includes the SQL Server as database.
Now, the web experiment goes through the following steps:
The following picture illustrates the structure of the three tables associated with the three already finished remote laboratories.
The tables on the left hold the measurement requests, and their structure differs from one laboratory to another.
The tables on the right hold measurement responses and for each table in the left, there is a corresponding table on the right.
For each record in the left table there is one corresponding record (with the same id and id_session) in the right table for a solved request and for unsolved requests there is no corresponding record. This record (response) is created by an application which does the actual data measuring.
The following picture presents a snapshot with example records from the requests table for the “Electromagnetic materials” laboratory.
The following picture presents a snapshot with example records from the responses table for the “Electromagnetic materials” laboratory.
Examples of Java Applets using a Web Database System
These Applets work based on the following schema:
In a typical distributed system built for allowing web-experiments on real equipment, the database is found on the server level. The server (be it an API or a Web Service) will interact with the database as information support.
Following are the Java applets used for this database experiment. Their complete descriptions are at the corresponding laboratories from the courses: Electrical Materials, Measurements of Electronic Devices and Circuits, Electrical Drivers Simulation.
The scenario using web-services (red arrow) is currently used by the remote laboratories corresponding to the course mentioned above.
This database laboratory uses only the Custom Application linked to the Database from the scenario above (the yellow arrow).
Being a database application, this database laboratory uses data extracted from the database, wich represents a unique set of experimental results, previously stored in the database.
IMPORTANT: In order to be able to use the experiments from the points A, B and C, you need to set up an ODBC data source on your operating system. Click here to see how to set up the ODBC on your system.
A) Electrical Materials experiment
The measurement is done by the following schema:
B) Measurement of Electronic Devices and Circuits experiment
C) Electrical Drives Simulation experiment
Part 2. Java Applet for normalizing databases
The normalization is important for eliminating redundancies and thus increasing the simplicity and reliability of the database systems.
The corresponding theory notions are in the subchapter 3.2. (theory and examples) of this course.
Here is an example of a normalized database:
The user enters the number of attributes of the relation and the dependencies between the attributes. After finishing, the user clicks the find normal forms button and the application shows the results.
We have a relation with a number of attributes for which we want to determine the first, the second and the third normal form. For this, the user needs to enter the number of attributes of the relation and the dependencies between the attributes. The application doesn't report if the datas are entered wrong so the user should check the validy of the data. In our case the dependencies between atributes should be valid. Using this dependencies, the application determines the first, the second and the third form of the relation.
How it works ?
First time the user chooses the number of attributes n of the relation. Pressing the button Populate, the lists From and To are populated with a number of elements equal to the number of attributes chosen by user. The elements from these lists are the first n letters of the alphabet. If the number of elements n is greater than the number of letters of the alphabet, then the lists contain special characters too.
For defining dependencies of the relation the user should use just simple dependencies (one to one). The application doesn’t validate the data input, so the user should be the one which assures the correctitude of the dependencies inserted (it shouldn’t appear cycles between dependencies and the primary key should be formed by just one single attribute).
If the user has inserted a wrong data, he must go back at the action that makes the completion of the lists From and To by pressing the button Populate. This will erase all dependencies inserted before.
After the user has finished the insertion of dependencies, all three normal forms are computed when the user presses the button Find normal forms.
The normal forms obtained
are inserted into three lists (a list for every normal form). Every table
obtained for a normal form has the following syntax ry (list of attributes
from the table with index y). The attributes which are followed by an apostrophe
character are included into the primary key of that table.