1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

CE203 - Application Programming Autumn 2013CE203 Part 51 Part 5.
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
Distributed Application Development B. Ramamurthy.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 32 Java Database.
JDBC Overview Autumn 2001 Lecturer: C. DeJong. Relational Databases widespread use used via SQL (Structured Query Language) freely available powerful.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
1 Lecture 29 More on JDBC Overview  Objectives of this lecture  JDBC and its Drivers  Connecting to Databases (Java’s Connection class)  Querying a.
JDBC. In This Class We Will Cover: What SQL is What ODBC is What JDBC is JDBC basics Introduction to advanced JDBC topics.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 11. DATABASE CONNECTIVITY IN JAVA JDBC Programming JDBC (Java Database Connectivity) is the specification of a.
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
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
JDBC Java Database Connectivity. What is an RDBMS? Relational database management system. There are other kinds of DBMS. Access is a GUI on a JET RBDMS.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 8 Object Oriented Programming in Java Advanced Topics Java Database.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Database Programming in Java Corresponds with Chapter 32, 33.
Java Utility Classes CS 21b. Some Java Utility Classes Vector Hashtable StringTokenizer * import java.util.*;
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Announcements Read JDBC Project Step 5, due Monday.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
Connecting to Oracle using Java November 4, 2009 David Goldschmidt, Ph.D. David Goldschmidt, Ph.D.
Object-Oriented Software How does it differ from procedural? How is it similar to procedural? Why has it become so popular? Does it replace or supplement.
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
JDBC. JDBC stands for Java Data Base Connectivity. JDBC is different from ODBC in that – JDBC is written in Java (hence is platform independent, object.
JDBC  The JDBC (Java Database Connectivity) API helps a Java program to access a database in a standard way  JDBC is a specification that tells the.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Chapter 25 Databases. Chapter Scope Database concepts Tables and queries SQL statements Managing data in a database Java Foundations, 3rd Edition, Lewis/DePasquale/Chase25.
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Copyright © 2002 ProsoftTraining. All rights reserved. Building Database Client Applications Using JDBC 2.0.
Computer Science [3] Java Programming II - Laboratory Course Lab 9: Accessing Databases with JDBC Instructions on Setting Accesses Connecting to and Querying.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
1 CS 430 Database Theory Winter 2005 Lecture 14: Additional SQL Topics.
JDBC CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
DataBases and SQL INFSY 547 Spring Course Wrap Up April 12: Complete Work on Servlets Review of Team Projects Close of Portfolio Work April 19:
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Database Access Using JDBC BCIS 3680 Enterprise Programming.
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.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Basics of JDBC Session 14.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
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.
JDBC.
ISC321 Database Systems I Chapter 2: Overview of Database Languages and Architectures Fall 2015 Dr. Abdullah Almutairi.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
DEPTT. OF COMP. SC & APPLICATIONS
Note: To complete the examples in this section you need access to a database!! Most of the examples work for any database with JDBC drivers. However, connecting.
CS320 Web and Internet Programming Database Access with JDBC
Advanced Web Automation Using Selenium
JDBC.
MSIS 655 Advanced Business Applications Programming
Java Database Connectivity
Using a Database with JDBC
Java API for Database Connectivity
Storing and Processing Sensor Networks Data in Public Clouds
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Presentation transcript:

1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002

2 Accessing DBMSs DBMS: DataBase Management System SQL: standard query language –Typed at command line –Forms-based interfaces –Direct-manipulation interfaces Programming APIs: –ODBC is an implementation API for SQL Open DataBase Connectivity A platform-independent standard JDBC is a java version of this –Special scripting languages also exist PHP, Cold Fusion, etc.

3 Programming DBMSs The DBMS Server –A continuously running process –Supports many different databases simultaneously The data can be owned by different people Each database within the DBMS has its own name, owners, password, tables –The application program connects to the DBMS server First makes a connection Then enters a loop of issuing queries and receiving results Somewhat like a web server in this respect

4 Mysql DBMS Oracle DBMS Mysql DriverOracle Driver Driver Manager JDBC API Java Application

5 The Java Process Connects to the DBMS Server Java Application Process Database Server

6 Can also connect to a Web Server Java Application Process Database Server Web Server

7 Using SQL Issue a query to the database Types of queries: –Find out which tables are available –Add a table –Add data to a table –Update data in a table –Select rows from a table –Join rows across two or more tables –… many more

8 SQL Query: Use

9 SQL Query: Show

10 SQL Query: Describe

11 SQL Query: Select

12 SQL Query: Describe

13 SQL Query: Select

14 SQL Query: Count(*)

15

16 SQL Query: Create and Insert

17 SQL Query: Load (Input text file is tab-delimited)

18 Sample SQL Join A join combines rows from different tables select t1.item, t1.name from items as t1, item_nature as t2, nature as t3 where t1.item = t2.item and t2.id = t3.id and t3.name = “hare”;

19

20 Using the JDBC API import java.sql.*; Facilities: –Making a connection with a database via the DriverManager facility –Sending SQL statements to a database –Retrieving and updating the results of a query –Standard mappings for SQL types to classes and interfaces in the Java programming language –Custom mapping an SQL user-defined type (UDT) to a class in the Java programming language –Metadata –Exceptions

21 Using SQL in JDBC Compose a Query –Represented as a String Create a Statement Instantiate Statement with a Query Execute the Query –Send it to the DBMS Receive the ResultSet –Optionally extract the ResultSetMetaData Process the contents of the ResultSet Repeat

22

23

24

25

26

27

28 Assignment Write java code to create and then use the contents of a DBMS database Use supplied code; go from there.