CPSC 310 Lab 1: Setting up and Using SimpleDB in Java with Eclipse, Lab Reports of Deductive Database Systems

The steps to set up and use the simpledb database system in java using eclipse ide. It covers downloading and installing the required software, setting up the project, and running the server and client applications. Students are expected to complete specific tasks and submit the results.

Typology: Lab Reports

Pre 2010

Uploaded on 02/13/2009

koofers-user-0fl
koofers-user-0fl 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPSC 310 Lab 1, Summer 2008, RonnieWard
Assigned 5/28/08. DUE in class on 6/9/08
1
The goal of this first project (or lab) is to get you into Java under Eclipse working with
the SimpleDB by Ed Sciore. This will start your understanding of how a relational
database system might be implemented. Answer specific questions in this document and
submit your results via CSNET in a single ZIP file. COMMENT the code you write!
Also, turn
1. Make sure your development machine is set up to run Eclipse, which is a free Java IDE
that you can download free from www.eclipse.org. I’m using version 3.3 of Eclipse.
Create a project, add a Java ‘Hello World’ class to it, and run it as a ‘Java application’.
You should see ‘Hello World’ appear in the console window. Also, if not already
installed, download and install the Java SE Runtime Environment 6 from
http://java.sun.com/javase/downloads/index.jsp. Check to make sure the installed Java
runtime is tied into Eclipse—Under Eclipse, click Window->Preferences->Java-
>Installed JRE and you should see it installed. If not, click the Add button and add 1.6
(browse and find the installation folder). Also, make sure ECLIPSE is set to auto
compile. Under ECLIPSE click Project and check mark Build Automatically. You can
leave the 1.5 JRE (or earlier version) installed and later switch back to it if needed.
2. Download the free DBMS simpledb.zip version 2.6 from
www.cs.bc.edu/~sciore/simpledb/intro.html and extract it to a local directory (this will
create a folder named SimpleDB_2.6). Create a new ECLIPSE project and give it a
name—say, SimpleDB_2.6. This will create a “src” folder in the project (you’ll use in the
next step). To add the SimpleDB_2.6 distribution to the project, right mouse click the
Project’s src folder -> Import -> File System -> Browse to the SimpleDB_2.6
distribution and select OK -> checkmark SimpleDB_2.6 -> and then expand the view by
clicking the “+” sign. Expand the view of folder studentClient and UNCHECK the Derby
box then click OK. Locate package “studentClient.simpledb” and to each source file add
the following declaration: package studentClient.simpledb; All the “red x’s” should
disappear, (If not, make sure the JRE 6 libraries are in the build path of the Project).
To run the rmi server, right mouse click the project name SimpleDB_2.6 and select Run
As -> Open Run Dialogue -> Java Application and fill in the Name field as rmiregistry.
Under “Main Class” check mark the item “include system libraries when searching for a
main class” and click the Search button. From the list, select RegistryImpl and run it.
A console window will appear with no output. Next, start the simpledb server. Open
another Run Dialogue as you did for the rmiregistry and fill in the Name field as Startup
SimpleDB. In the “Main Class” field enter simpledb.server.Startup. Select the
“Arguments” tab and enter the database name “studentdb” as a Program Arguments.
Then select Apply and then Run. A console window will open and you’ll see output with
a last line saying “database server ready”. Turn in the output created by running this
Startup application.
To test using the SimpleDB server, open the file CreateStudentDB in the
studentClient.simpledb package and select “Run As” a java application. Turn in the
output created by running this application. Be careful here. I want you to show the output
on the server console and the output on the client console!
pf2

Partial preview of the text

Download CPSC 310 Lab 1: Setting up and Using SimpleDB in Java with Eclipse and more Lab Reports Deductive Database Systems in PDF only on Docsity!

CPSC 310 Lab 1, Summer 2008, RonnieWard Assigned 5/28/08. DUE in class on 6/9/

The goal of this first project (or lab) is to get you into Java under Eclipse working with the SimpleDB by Ed Sciore. This will start your understanding of how a relational database system might be implemented. Answer specific questions in this document and submit your results via CSNET in a single ZIP file. COMMENT the code you write! Also, turn

  1. Make sure your development machine is set up to run Eclipse, which is a free Java IDE that you can download free from www.eclipse.org. I’m using version 3.3 of Eclipse. Create a project, add a Java ‘Hello World’ class to it, and run it as a ‘Java application’. You should see ‘Hello World’ appear in the console window. Also, if not already installed, download and install the Java SE Runtime Environment 6 from http://java.sun.com/javase/downloads/index.jsp. Check to make sure the installed Java runtime is tied into Eclipse—Under Eclipse, click Window->Preferences->Java-

Installed JRE and you should see it installed. If not, click the Add button and add 1. (browse and find the installation folder). Also, make sure ECLIPSE is set to auto compile. Under ECLIPSE click Project and check mark Build Automatically. You can leave the 1.5 JRE (or earlier version) installed and later switch back to it if needed.

  1. Download the free DBMS simpledb.zip version 2.6 from www.cs.bc.edu/~sciore/simpledb/intro.html and extract it to a local directory (this will create a folder named SimpleDB_2.6). Create a new ECLIPSE project and give it a name—say, SimpleDB_2.6. This will create a “src” folder in the project (you’ll use in the next step). To add the SimpleDB_2.6 distribution to the project, right mouse click the Project’s src folder -> Import -> File System -> Browse to the SimpleDB_2. distribution and select OK -> checkmark SimpleDB_2.6 -> and then expand the view by clicking the “+” sign. Expand the view of folder studentClient and UNCHECK the Derby box then click OK. Locate package “studentClient.simpledb” and to each source file add the following declaration: package studentClient.simpledb; All the “red x’s” should disappear, (If not, make sure the JRE 6 libraries are in the build path of the Project).

To run the rmi server, right mouse click the project name SimpleDB_2.6 and select Run As -> Open Run Dialogue -> Java Application and fill in the Name field as rmiregistry. Under “Main Class” check mark the item “include system libraries when searching for a main class” and click the Search button. From the list, select RegistryImpl and run it. A console window will appear with no output. Next, start the simpledb server. Open another Run Dialogue as you did for the rmiregistry and fill in the Name field as Startup SimpleDB. In the “Main Class” field enter simpledb.server.Startup. Select the “Arguments” tab and enter the database name “studentdb” as a Program Arguments. Then select Apply and then Run. A console window will open and you’ll see output with a last line saying “database server ready”. Turn in the output created by running this Startup application.

To test using the SimpleDB server, open the file CreateStudentDB in the studentClient.simpledb package and select “Run As” a java application. Turn in the output created by running this application. Be careful here. I want you to show the output on the server console and the output on the client console!

CPSC 310 Lab 1, Summer 2008, RonnieWard Assigned 5/28/08. DUE in class on 6/9/

  1. Package simpledb.server a. What is the default number of buffers? b. What is the default log file name? c. Explain why there is a logic difference if the code is started with a new versus an existing name. d. Under what circumstances will the message “can’t rollback” be output?
  2. Package studentClient.simpledb includes other applications besides the class CreateStudentDB, which was used to create the “studentdb”. a. Use the Windows file explorer to locate the “studentdb” folder created. Turn in a detailed listing of the folder contents (there are about a dozen files listed). b. Run the application StudentMajor. Be careful. Turn in what was output to the server console, and what was output to the application console.
  3. Examine the code in the class FindMajors in package studentClient.simpledb. a. What is the “generic code pattern” to query a database from a java program?
  4. Package studentClient.simpledb and class SQLInterpreter a. What is the command prompt string when this program is run? b. Aside from the command to exit the interpreter, what two SQL statements are supported? c. What two field data types are supported in the code? d. Under what circumstance would the code output the following? 2 records processed
  5. Package simpledb.file a. isNew is false under what condition? b. Is the argument to FileMgr a file name, or a directory name? c. What is the file-naming pattern in simpledb?
  6. Write a simpledb java program to create a table named firsttable with the following schema & data. Be sure and comment your code and turn it in.

firsttable (id int, name varchar(25)) frows: (10, 'ten'), (20,'twenty'), (30,'thirty')

  1. Launch the SQLInterpreter and see if you can write an SQL statement to display all three rows in the firsttable you created. Turn in the console output of your session with simpledb to display firsttable.
  2. What is the name of the database in which you created firsttable? How did you specify that filename to simpledb?