CSCI 6962: Server-side Design and Programming

Slides:



Advertisements
Similar presentations
Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
Advertisements

A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
The Use of Microsoft based Technologies for the benefit of the Community Prof. Avi Mendelson – Microsoft & Technion - Taub 643.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Creating Database Tables CS 320. Review: Levels of data models 1. Conceptual: describes WHAT data the system contains 2. Logical: describes HOW the database.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Concepts of Database Management Sixth Edition
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
ASP.NET Programming with C# and SQL Server First Edition
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Database Programming in Java Corresponds with Chapter 32, 33.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Concepts of Database Management Seventh Edition
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 MySQL and JDBC.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
1 Working with MS SQL Server Textbook Chapter 14.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with MSSQL Server Code:G0-C# Version: 1.0 Author: Pham Trung Hai CTD.
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.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
Concepts of Database Management Seventh Edition
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Chapter 8 Databases.
JDBC Tutorial CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Visual Programing SQL Overview Section 1.
Module Review Basic SQL commands: Create Database, Create Table, Insert and Select 2. Connect an SQL Database to PHP 3. Execute SQL Commands in.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Database Access Using JDBC BCIS 3680 Enterprise Programming.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
JDBC Java and Databases. SWC – JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
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.
MYSQL AND MYSQL WORKBENCH MIS2502 Data Analytics.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
Database Processing with JSP ISYS 350. Database Applications Applications Database Server Queries/Updates Results.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
3 A Guide to MySQL.
CS320 Web and Internet Programming SQL and MySQL
JDBC.
Chapter 8 Working with Databases and MySQL
CS1222 Using Relational Databases and SQL
MSIS 655 Advanced Business Applications Programming
IST 311 Object-Oriented Design and Software Applications
Presentation transcript:

CSCI 6962: Server-side Design and Programming Server-side Databases and Drivers 1

Outline Database servers and drivers Databases and the MVC paradigm SQL overview The Derby database server Creating databases Populating a database MySQL

Databases and E-Commerce Long term information stored in databases Queries used to produce lists of products Updates used to store orders New record created for order in Order table Customer information added to other tables Quantities updated in inventory tables

Database Access Object Database Servers Access to database controlled by database server Constantly running (like web container) Server runs database queries and updates for databases it controls Server handles security of database Most are password-controlled MySQL (free) Oracle MS Server Not Access! Database server Web server database Database Access Object

Database Servers Programs create statement objects inside server Server executes them on the database Server stores results if query performed Program may then access those results Database server Web server Statement object select * from books database Database Access Object ResultSet object productCode title price productCode title price productCode title price

Database Drivers Database server does not understand Java/C# commands Only understands its own DBMS protocols Each server has its own DBMS Need a database driver to perform translation Obtain from database server provider Install in Java libraries web container database server JDBC database driver JSF page Managed bean/ support class DBMS

Databases and the MVC Paradigm Usually do not directly access database from JSF/ASP pages Requires both web programming and SQL knowledge Usually done in model classes (such as managed bean) Bean stores to database when commanded to Bean performs database query when need to retrieve data Often have built-in tools for database management SqlDataSource object in ASP web container database server JSF pages/ Managed bean Support classes/ tools ASP pages/ Code behind

SQL and Databases Commands to database server use SQL (structured query language) Common examples: Query for all records matching some condition: select field from table where condition Example: select * from books where price < 10 Delete all records matching some condition: delete from table where condition Example: delete from books where ISBN = ‘0004’

SQL and Databases Set new field value for all records matching some condition: update table set field = value WHERE condition Example: update books set price = 9.95 where productCode = ‘0004’ Insert new record with given field values: insert into table (field, field, field…) values (value, value, value…) Example: insert into books (productCode, title, price) values (‘0004’, ‘Green Eggs and Ham’, 9.95)

Derby Open source database server from Apache Not as powerful as MySql, Oracle, etc. Low memory overhead Fewer access privileges required Included in later versions of NetBeans Create database, create connection to it Create tables and execute SQL commands Manipulate database from Java program running in NetBeans

Creating a Derby Database Go to Services tab Expand Databases node Right-click Java DB node Choose Create Database

Creating a Derby Database Give database a name Set User name to app Strange schema errors otherwise Set a password (I usually also just use “app”)

Creating a Derby Database Must connect to the database before using Right-click on link corresponding to database Choose Connect

Adding a Table Expand link to database Expand App node Right-click Tables node Select Create Table Will get Create Table dialog

Adding a Table Add column for each field of table First field should be key field Check Primary key Check Unique Set types and other properties as needed # of characters in VARCHAR Etc.

Adding a Table Final table structure now shown in services window

Manipulating the Database Can execute queries directly (without using code) Right click table Select Execute Command Brings up command window Type in SQL statement Right-click window Select Run Statement

Viewing the Database Right click table Select View Data Executes SELECT * FROM tablename query

MySQL Free database server Go to www.mysql.com Follow Products tab Go to MySQL Community Server Download and run

MySQL Database Driver From downloads page at mysql.com Go to connectors page Go to Connector/J (for Java) Download and save Extract the mysql-connector-java-5.version-bin.jar file

MySQL Database Driver In Netbeans right-click Libraries folder of project Choose Add JAR/Folder Select mysql-connector-java-5. version-bin.jar file from downloads

The MySQL Interface Command line interface to manipulate databases MySQL controls Available from PROGRAMS menu Will need to give password Can create new databases create database databasename;

Creating Database Tables Must define field names and field types Some types: varChar(n) : String of up to n characters int(n) : integer up to n digits double(n, d) : decimal number up to n digits and d after the decimal Must declare a key field with “primary key” create table tablename ( keyfieldname type primary key, fieldname type, fieldname type, … );