Database Programming using JSP and MySQL 2003.4.13 Byung-Hyun Ha

Slides:



Advertisements
Similar presentations
Bin Fu 03/27/ Spring 2012 Homework 7 Building A Web Application School of Computer Science.
Advertisements

19 augustus 2003augustus 2003 JSP-2. BICT 2JDBC BICT 3Install MySQL Download MySQL daemon – Free – Windows version… Start Daemon – Mysqld-nt.exe Download.
Java, Access, SQL, HTML. Three-tier architecture involves: Client - Browser Server - Tomcat Database - Access - Server-side language - JSP could just.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
Advanced Java Programming – Eran Toch Methodologies in Information System Development Tutorial: Advanced Java Programming and Database connection Eran.
Murali Mani Web Interface. Murali Mani Options PHP with mySQL JSP/Servlets with JDBC on mySQL/Oracle Others …
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
TUTORIAL (1) Software installation Written by: Eng. Ahmed Mohamed Abdel Ghafar, Edited by Eng. Muhammed Hammad, Eng. Hamdy Soltan & Eng. Osama Talaat.
UFCE4Y UFCE4Y-20-3 Components and Services Julia Dawson.
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Database Management Systems 1 Oracle Programming.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
E-COMMERCE JOBS This project (Project number: HU/01/B/F/PP ) is carried out with the financial support of the Commssion of the European Communities.
Views, Indexes and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Haiman Tian 1.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
JAVA Database Access. JDBC The Java Database Connectivity (JDBC) API is the industry standard for database- independent connectivity between the Java.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
CS 405G: Introduction to Database Systems Database programming.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
PHP Part 2.
Servlets Database Access. Agenda:  Setup Java Environment  Install Database  Install Database Drivers  Create Table and add records  Accessing a.
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
Mark Dixon 1 09 – Java Servlets. Mark Dixon 2 Session Aims & Objectives Aims –To cover a range of web-application design techniques Objectives, by end.
CS 160: Software Engineering October 1 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Index and JDBC/JSP tutorial Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
JSP program that interacts with HTML form & Access Data Base.
Chapter 8 Databases.
JDBC. A Basic MySQL Tutorial MySQL is an open source database management software that helps users store, organize, and retrieve data. It is a very powerful.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
MySQL & JDCB Αλέξανδρος Καρακασίδης Δεκέμβριος 2004.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Leman Akoglu 11/11/ Fall 2009 Recitation Homework 9 Building A Web Application Phase-II School of Computer Science.
웹 프로그래밍 설계 및 실습 MVC1 Member 이경화
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Tasks Needed for MissionMapEditor Martin Q. Zhao September 18, 2010.
OOSSE Week 7 Java Server Pages Format of lecture: Introduction What are Java Server Pages? (JSPs) What do you need to run JSPs? Demo of an example of a.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Basics of JDBC.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Web Programming Assistant Professor Xiaozhong Liu
1 Database Management Systems (II) Chapter 14. JDBC, Java Server Pages, and MySQL © 2005 by Dr. F. Lin.
1 Download current version of Tomcat from: g/tomcat/ g/tomcat/ Install it in: C:\Program Files\Apache.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
JSP/Database Connectivity Instructor: Dr. M. Anwar Hossain.
Java Database Connectivity JDBC. Open Database Connectivity developed by Microsoft to provide interaction with databases using SQL. Use the JDBC-ODBC.
Database Processing with JSP ISYS 350. Database Applications Applications Database Server Queries/Updates Results.
데이터 베이스 설계 및 실습 #11 - JSP 예제.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
1. Writing a Java program to connect to SQL Server 2008 and Create a table Populate the table (insert data) Perform queries to retrieve information from.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Instructor: Jinze Liu Fall /8/2016Jinze University of Kentucky 2 Database Project Database Architecture Database programming.
MySQL root 암호 $ mysqladmin -u root -p password new-password $ mysql -u root mysql mysql> update user set password = password('new-password') where user.
Database Programming Basic JDBC Programming Concepts.
JSP and DB.
JDBC and OCCI 10/29/2017.
CS320 Web and Internet Programming Database Access with JDBC
Advanced Web Automation Using Selenium
HW#4 Making Simple BBS Using JDBC
Introduction to Server-Side Web Development using JSP and Databases
Database Programming Using JDBC and MySQL C API
Using a Database with JDBC
JDBC Example.
Presentation transcript:

Database Programming using JSP and MySQL Byung-Hyun Ha

Table of Contents  Database Application  Overview of Application Building  Database Access via Telnet  File System Access via FTP  First JSP Programming  Database Programming using JSP  Discussion

Database Application  Multi-tier architecture front-end back-end Networ k presentation layer business logic DB front-end back-end Networ k business logic + presentation layer DB

Our Database Application  게시판 front-end back-end Networ k business logic + presentation layer DB Web browserJSP pageMySQLInternet

ike.ie.pusan.ac.kr (linux machine) Back-End Architecture  Powered by linux Internet Apache Tomcat (Application Server) JSP page (program) MySQL (DBMS) Database

Overview of Application Building  Telnet + FTP + MySQL console ike.ie.pusan.ac.kr Telnet daemon Internet FTP daemon shell file system JSP page (program) Database Tomcat MySQL

Database Access via Telnet 1.Login  시작  실행  “ telnet ike.ie.pusan.ac.kr ”  ID 와 password 입력 2.Password 의 수정  passwd 3.Logout  exit 4. 다시 login

Database Access via Telnet 1.Database console 에 login  mysql -u uXXXXX -p  Password 입력 2.Database console 에서 logout  quit 3.Password 의 수정  mysqladmin -u uXXXXX –p password ‘YYYYYYYY’ 4.Console 에 다시 login

Database Access via Telnet 1. 사용 가능한 database 보기  show databases; 2.Database 사용  use dXXXXX 3.Table 생성  create table test(no int, name varchar(20)); 4.Table 확인  show tables; 5.Record 입력  insert into test values(10, ‘abc’); 6. 입력된 내용 확인  select * from test;

Database Access via Telnet ike.ie.pusan.ac.kr Telnet daemon Internet FTP daemon shell file system JSP page (program) Database Tomcat MySQL  지금 한 것

File System Access via FTP  테스트 Web page 작성 1. 시작  실행  “ notepad ” 2. 다음을 입력 3. 바탕 화면에 ‘test.html’ 로 저장 Hello! HTML!

File System Access via FTP 1.Internet Explorer 실행 2. 주소 창에 다음을 입력  ftp://ike.ie.pusan.ac.kr/webapps/ 3. 파일  다른 이름으로 로그인  자신의 ike.ie.pusan.ac.kr 계정을 사용하여 로그인 4.‘test.html’ 을 Internet Explorer 에 drag & drop 5. 새로운 Internet Explorer 실행 

File System Access via FTP  지금 한 것 ike.ie.pusan.ac.kr Telnet daemon Internet FTP daemon shell file system JSP page (program) Database Tomcat MySQL

File System Access via FTP 1.MySQL 을 종료함 2. 현재 경로의 내용확인  ls 3.‘test.html’ 확인  cd webapps  ls

Our First JSP Programming  테스트 JSP page 작성  notepad 를 열어 다음을 입력하고, ‘test.jsp’ 로 저장 <% String str = request.getParameter("name"); if (str != null) { out.println("You have input " + str); } %> Your input?

Our First JSP Programming 1.‘test.jsp’ 를 ike 로 전송 2. 결과 확인

Our First JSP Programming  만일 오류가 있다면 ?

Database Programming using JSP  ‘list.jsp’ 의 작성 <% try { String dbUrl = "jdbc:mysql://localhost/dXXXXX?user=uXXXXX&password=YYYYYY"; Connection conn = DriverManager.getConnection(dbUrl); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM test"); while (rs.next()) { int no = rs.getInt("no"); String name = rs.getString("name"); out.println(no + ", " + name + " "); } rs.close(); stmt.close(); conn.close(); } catch (Exception e) { out.println(e); } %> insert

Database Programming using JSP  ‘insert.jsp’ 의 작성 <% String no = request.getParameter("no"); String name = request.getParameter("name"); if (no != null && name != null) { try { String dbUrl = "jdbc:mysql://localhost/dXXXXX?user=uXXXXX&password=YYYYYY"; Connection conn = DriverManager.getConnection(dbUrl); Statement stmt = conn.createStatement(); String query = "INSERT INTO test (no, name) VALUES (" + no + ", '" + name + "')"; stmt.execute(query); stmt.close(); conn.close(); out.println("one row inserted."); } catch (Exception e) { out.println(e); } %> list

Overview of Application Building  Telnet + FTP + MySQL console ike.ie.pusan.ac.kr Telnet daemon Internet FTP daemon shell file system JSP page (program) Database Tomcat MySQL

Database Application  Multi-tier architecture front-end back-end Networ k presentation layer business logic DB front-end back-end Networ k business logic + presentation layer DB

Discussion  HTML vs. JSP  한글 ?  숙제의 의미 ?