Project Two Database Setup Notes

Download Report

Transcript Project Two Database Setup Notes

Database Design
Dr. M.E. Fayad, Professor
Computer Engineering Department, Room #283I
College of Engineering
San José State University
One Washington Square
San José, CA 95192-0180
http://www.engr.sjsu.edu/~fayad
2003
SJSU -- CmpE -- M.E. Fayad
P2-S1
MySQL
Project 2:
The MySQL
Relational Database
2003
SJSU -- CmpE -- M.E. Fayad
P2-S2
MySQL
Lesson Objectives
Objectives

Understand Project 2

Learn about:
 Project Deliverables
 Setting up MySQL
 Java & JDBC
 Sample Code
2003
SJSU -- CmpE -- M.E. Fayad
P2-S3
MySQL
Project 2
You will use your Schema From Project
One to build a database system. You
may adjust it if necessary or desired.
 Come up with 10 creative and useful
queries in SQL.
 You will use MySQL database, Java,
and JDBC.
 You will create two separate programs 4

2003
SJSU -- CmpE -- M.E. Fayad
P2-S4
MySQL
2 Programs

First Program Will:
– Connect To the MySQL database
– Create a Project 2 Database
– Create all tables with proper attributes and
attribute types
– Insert at least 10 data entries for each
table.
2003
SJSU -- CmpE -- M.E. Fayad
P2-S5
MySQL
2 Programs

Second program will
– Connect to the database
– Execute at least 10 queries again your
database
– Print the results in a text or html file, or a
simple GUI.
– The results must be organized and easy to
read. State the SQL query and show the
result.
2003
SJSU -- CmpE -- M.E. Fayad
P2-S6
MySQL
MySQL Setup
Go to www.mysql.com
 Download

1. MySQL 4.0 Production Release Database
2. MySQL Control Center GUI Client
3. MySQL Connector/J 3.0 Production
Release API
2003
SJSU -- CmpE -- M.E. Fayad
P2-S7
MySQL
Database Setup


Unzip the archive mysql-4.0.12-win2.zip
Run setup.exe
Click next->next->… etc.. Accept all defaults
Reboot your System to start the database
service.
Run winmysqladmin.exe located in
C:\mysql\bin by double clicking the icon.
Enter a user name and password.
2003
SJSU -- CmpE -- M.E. Fayad




P2-S8
MySQL
GUI Client Setup
Unzip the archive mysqlcc-0.9.1-win32.zip
 Run Setup.exe
 Click next->next->next->… etc…
 Done

2003
SJSU -- CmpE -- M.E. Fayad
P2-S9
MySQL
Connecter/J Setup
This package contains the JDBC driver
and provides the API used to interface
with the database using java.
 Unzip the Archive

– mysql-connector-java-3.0.6-stable.zip
Find the “com” folder and place this
folder in your java class path
 Test by trying to compile the sample
code

2003
SJSU -- CmpE -- M.E. Fayad
P2-S10
MySQL
Sample Code

Two Java files available on the course’s
website:
– Project2.java
• This file contains sample code to connect to the
database, create a project2 database, add
tables to this database, and add a one tuple of
data.
– Project2Query.java
• Connects to the database, executes on query,
and displays the results to the command line.
2003
SJSU -- CmpE -- M.E. Fayad
P2-S11
MySQL
Questions?
2003
SJSU -- CmpE -- M.E. Fayad
P2-S12
MySQL