A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.

Slides:



Advertisements
Similar presentations
 2003 Prentice Hall, Inc. All rights reserved. Chapter 22 – Database: SQL, MySQL, DBI and ADO.NET Outline 22.1 Introduction 22.2 Relational Database Model.
Advertisements

Management Information Systems, Sixth Edition
Introduction to Structured Query Language (SQL)
CSE 190: Internet E-Commerce Lecture 10: Data Tier.
Chapter 3: Using SQL Queries to Insert, Update, Delete, and View Data
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
CSC 2720 Building Web Applications Database and SQL.
Concepts of Database Management Sixth Edition
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ 1 Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
ASP.NET Programming with C# and SQL Server First Edition
Using SQL Queries to Insert, Update, Delete, and View Data Date Retrieval from a single table & Calculations © Abdou Illia MIS Spring 2015.
 2008 Pearson Education, Inc. All rights reserved Database: SQL, MySQL, ADO.NET 2.0 and Java DB.
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
Database Technical Session By: Prof. Adarsh Patel.
Introduction to SQL Steve Perry
2440: 141 Web Site Administration Database Management Using SQL Professor: Enoch E. Damson.
INLS 560 – R ELATIONAL DATABASES Instructor: Jason Carter.
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CHAPTER 8 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 MySQL and JDBC.
Database: SQL and MySQL
10/17/2012ISC471/HCI571 Isabelle Bichindaritz 1 Technologies Databases.
1 Databases November 15, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel, and Goldberg. Published.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Database, SQL, and ADO.NET- Part 1 Session 11 Mata kuliah: M0874 – Programming II Tahun: 2010.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Instructor: Dema Alorini Database Fundamentals IS 422 Section: 7|1.
Databases MIS 21. Some database terminology  Database: integrated collection of data  Database Management System (DBMS): environment that provides mechanisms.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
 2008 Pearson Education, Inc. All rights reserved Database: SQL, MySQL, ADO.NET 2.0 and Java DB.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 22 - SQL, MySQL, DBI and ADO Outline 22.1 Introduction 22.2 Relational Database Model 22.3 Relational.
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
COM621: Advanced Interactive Web Development Lecture 11 MySQL – Data Manipulation Language.
Introduction to Database Programming with Python Gary Stewart
Database, SQL and ADO.NET
 2012 Pearson Education, Inc. All rights reserved.
JDBC.
Databases Intro (from Deitel)
Structured Query Language
Chapter 22 - SQL, MySQL, DBI and ADO
Structured Query Language
Java Chapter 6 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

A CCESSING D ATABASES WITH JDBC CH 24 C S 442: A DVANCED J AVA P ROGRAMMING

A database is an organized collection of data. A database management system ( DBMS ) provides mechanisms for storing, organizing, retrieving and modifying data for many users. Database management systems allow for the access and storage of data without concern for the internal representation of data. A language called SQL is the international standard language used almost universally with relational databases to perform queries and to manipulate data. Java programs communicate with databases and manipulate their data using the Java Database Connectivity (JDBC™) API. A JDBC driver enables Java applications to connect to a database in a particular DBMS and allows you to manipulate that database using the JDBC API.

Today’s most popular database systems are relational databases. A relational database is a logical representation of data that allows the data to be accessed A relational database stores data in tables. Tables are composed of rows, and rows are composed of columns in which values are stored. primary key a column (or group of columns) with a unique value that cannot be duplicated in other rows. Good examples of primary key columns are a social security number and employee ID number.

Different users of a database are often interested in different data and different relationships among the data. Most users require only subsets of the rows and columns For example, you might select data from the Employee table to create a result that shows where each department is located, presenting the data sorted in increasing order by department number. Some popular relational database management systems ( RDBMSs ) are Microsoft SQL Server, Oracle and MySQL.

entity-relationship ( ER ) diagram is diagram shows the database tables and the relationships among them. The first compartment in each box contains the table’s name and the remaining compartments contain the table’s columns. * There’s a one-to-many relationship between a primary key and a corresponding foreign key.

T ABLES WILL BE USED IN SQL QUERY :-

S TRUCTURED Q UERY L ANGUAGE (SQL)

B ASIC SELECT Q UERY : The basic form of a SELECT query the asterisk (*) wildcard character indicates that all columns from the tableName table should be retrieved. For example, to retrieve all the data in the Authors table, use Example :

WHERE C LAUSE The basic form of a query with selection criteria For example, to select the Title, EditionNumber and Copyright columns from table Titles for which the Copyright date is greater than 2010, use the query:

P ATTERN M ATCHING : Z ERO OR M ORE C HARACTERS Operator LIKE is used for pattern matching with wildcard characters percent ( % ) and underscore (_). A pattern that contains a percent character (%) searches for strings that have zero or more characters at the percent character’s position in the pattern. Example:

P ATTERN M ATCHING : A NY C HARACTER An underscore ( _ ) in the pattern string indicates a single wildcard character at that position in the pattern.

ORDER BY C LAUSE The basic form of a query with an ORDER BY clause ASCENDING ORDER :

D ESCENDING O RDER :

S ORTING B Y M ULTIPLE C OLUMNS

C OMBINING THE WHERE AND ORDER BY C LAUSES

M ERGING D ATA FROM M ULTIPLE T ABLES : INNER JOIN

INSERT S TATEMENT

UPDATE S TATEMENT the WHERE clause can be simplified as follows:

DELETE S TATEMENT

M ANIPULATING D ATABASES WITH JDBC 1 Connecting to and Querying a Database The example performs a simple query on the books database that retrieves the entire Authors table and displays the data. The program illustrates connecting to the database, querying the database and processing the result.

Output: