Swing Tutorial on Netbeans 6.0

5,319 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,319
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
53
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Swing Tutorial on Netbeans 6.0

  1. 1. MySQL-JSP tutorial February 26, 2008 Presented by: Anwar Hossain Email: anwar@mcrlab.uottawa.ca
  2. 2. Installing MySQL and Tomcat server • Download mysql for windows from: • http://dev.mysql.com/downloads/mysql/5.0.html#win32 • Install MySQL in your machine • Check by typing mysql from the command prompt to see mysql> command line • Download and install Tomcat as per the instructions in: • http://tomcat.apache.org/download-55.cgi • Type http://localhost:8080/ in the browser • If the index page appears, installing seems ok • Download JDBC connector for mYSQL to work with Tomcat server from: http://www.mysql.com/products/connector/j/ - Extract the zip file anywhere in the C drive. - Copy mysql-connector-java-3.1.14-bin.jar file from the C drive location and put it under C:Tomcat 5.0commonlib, assuming your Tomcat is installed in C:Tomcat..
  3. 3. Creating MySQL script • Open NOTEPAD or any other text editor in windows • Type the following: -- -- create mysql database -- CREATE DATABASE hcidb; USE hcidb;
  4. 4. Creating MySQL script -- -- Table structure for table students; -- DROP TABLE IF EXISTS students; CREATE TABLE students( studentID varchar(20) NOT NULL, fname varchar(25), lname varchar(25), department varchar(30), Note varchar(100), PRIMARY KEY (studentID) ) TYPE=InnoDB;
  5. 5. Creating MySQL script -- Insert some records INSERT INTO students values ("123456", "John", "Doe", "Computer", "research student"); INSERT INTO students values ("345678", "Jane", "Hunter", "Accounting", "project student"); INSERT INTO students values ("543216", "Alice", "Alicia", "Computer", "research student"); INSERT INTO students values ("576635", "Huang", "Hoo", "Management", "research student");
  6. 6. Creating MySQL script -- -- drop and create table -- DROP TABLE IF EXISTS courses; CREATE TABLE courses ( courseID varchar(10) NOT NULL, coursename varchar(30) NOT NULL, offeredin varchar(20), PRIMARY KEY (courseID) ) TYPE=InnoDB; INSERT INTO courses values ("csi1301", "Introduction to programming", "Fall"); INSERT INTO courses values ("acc3203", "Accounting basics", "Winter"); INSERT INTO courses values ("mgt1212", "Managing organization", "Fall");
  7. 7. Creating MySQL script -- -- drop and create table -- DROP TABLE IF EXISTS students_courses; CREATE TABLE students_courses( studentID varchar(20) NOT NULL, courseID varchar(10) NOT NULL, PRIMARY KEY (studentID, courseID) ) TYPE=InnoDB; INSERT INTO students_courses values ("123456", "csi1301"); INSERT INTO students_courses values ("123456", "acc3203"); INSERT INTO students_courses values ("543216", "csi1301"); INSERT INTO students_courses values ("576635", "mgt1212");
  8. 8. Creating MySQL script -- -- user creation and privilege -- GRANT ALL PRIVILEGES ON hcidb.* TO hciuser@'localhost' IDENTIFIED BY 'hciuser' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON hcidb.* TO hciuser@'%' IDENTIFIED BY 'hciuser' WITH GRANT OPTION; • Save this script file as myscript.sql
  9. 9. Creating MySQL script • Open command prompt window • Type mysql –u root –p • Give password for root • From the mysql> prompt, type . myscript.sql • Type exit • Again type mysql –u hciuser –p • Type hciuser as password • Type use hcidb; • Type show tables;
  10. 10. Creating webapps in Tomcat • Explore Tomcat root • Go to webapps directory • Copy Root directory and paste it with a new name e.g. hci • Write your first jsp page as index.jsp • Follow the hands-on shown in the class

×