Database JDBC Overview CS Programming Languages for Web Applications

Slides:



Advertisements
Similar presentations
Copyright  Oracle Corporation, All rights reserved. 2 Java and Databases: An Overview.
Advertisements

Java Database Connectivity (JDBC). 2/24 JDBC (Java DataBase Connectivity) - provides access to relational database systems JDBC is a vendor independent.
MC365 JDBC and Server-Side Programming: Updating a database via JDBC & Connection Pooling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
Java and Databases CS-328 Dick Steflik. Database Drivers Think of a database as just another device connected to your computer like other devices it has.
1 JDBC Java Database Connectivity. 2 c.pdf
JDBC. JDBC (Java Database Connectivity): JDBC is an API for the Java programming language that defines how a client may access a database. It provides.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Java Database Connectivity By: Abe Marji CS616. Agenda 1.Quick Review of Databases 2.What is SQL? 3.What is JDBC? 4.Advanced Functions of JDBC 5.Summary.
1 Lecture 29 More on JDBC Overview  Objectives of this lecture  JDBC and its Drivers  Connecting to Databases (Java’s Connection class)  Querying a.
CSE470 Software Engineering Fall Database Access through Java.
JAVA JDBC JAVA JDBC Java Database Programming Lamiaa Said.
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
Think Possibility Integrating Web Applications With Databases.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
CSE470 Software Engineering Fall Database Access through Java.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Java Utility Classes CS 21b. Some Java Utility Classes Vector Hashtable StringTokenizer * import java.util.*;
Announcements Read JDBC Project Step 5, due Monday.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
CS 405G: Introduction to Database Systems Database programming.
CONTROLPANEL Java.sql package This package provides the APIs for accessing and processing data which is stored in the database especially relational.
Connecting to Oracle using Java November 4, 2009 David Goldschmidt, Ph.D. David Goldschmidt, Ph.D.
JDBC Java and Databases, including Postgress. JDBC l Developed by Industry leaders l Three main goals: –JDBC should be an SQL-level API –JDBC should capitalize.
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
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.
Copyright © 2002 ProsoftTraining. All rights reserved. Building Database Client Applications Using JDBC 2.0.
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.
JDBC CHAPTER-2. JDBC - Java Database Connectivity. JDBC from Sun Microsystems provides API or Protocol to interact with different databases. With the.
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.
JDBC By 朱志興. Four driver types of JDBC (1) JDBC-ODBC bridge plus ODBC driver: Java Database Client JDBC- ODBC bridge ODBC driver Database Server A B C.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Database Access Using JDBC BCIS 3680 Enterprise Programming.
JDBC CS 260 Database Systems. Overview  Introduction  JDBC driver types  Eclipse project setup  Programming with JDBC  Prepared statements  SQL.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Basics of JDBC.
Basics of JDBC Session 14.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Ch. NoNameMarks 01AWT24 02Networking18 03JDBC20 04Swing18 05Servlet20 Advance Java Programming.
1 Principles of Database Systems With Internet and Java Applications Today’s Topic Chapter 8: Applications Programming for Relational Databases Instructor’s.
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
1 JDBC – Java Database Connectivity CS , Spring 2010.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
JDBC Statements The JDBC Statement, CallableStatement, and PreparedStatement interfaces define the methods and properties that enables to send SQL or PL/SQL.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
JDBC.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
JSP and DB.
Database: JDBC Overview
DEPTT. OF COMP. SC & APPLICATIONS
CS3220 Web and Internet Programming Database Access with JDBC
JDBC Database Management Database connectivity
JDBC – Java Database Connectivity
CS320 Web and Internet Programming Database Access with JDBC
Advanced Web Automation Using Selenium
Design and Implementation of Software for the Web
Client Access, Queries, Stored Procedures, JDBC
Interacting with Database
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
JDBC – ODBC DRIVERS.
Java Database Connectivity
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Presentation transcript:

Database JDBC Overview CS 4640 Programming Languages for Web Applications

JDBC JDBC API allows Java programs to connect to databases Database access is the same for all database vendors The JVM uses a JDBC driver to translate generalized JDBC calls into vendor specific database calls JDBC != Java Database Connectivity http://java.sun.com/docs/books/jdbc/intro.html Excerpt : “JDBC (TM) is a Java (TM) API for executing SQL statements. (As a point of interest, JDBC is a trademarked name and is not an acronym; nevertheless, JDBC is often thought of as standing for `Java Database Connectivity’.) ” CS 4640

Pure Java Driver (Type 4) There are four general types of JDBC drivers We will look at Type 4 DB Client Server Java Application Data Source JDBC API JDBC Driver Type 4 drivers are Efficient Simple to use and deploy Most commonly used CS 4640

Typical JDBC Programming Process Load the database driver Obtain a connection Create and execute statements executeQuery – to execute SQL select statements executeUpdate – to execute SQL statements that update a table Use result sets to navigate through the results Close the connection CS 4640

Simple Example CS 4640

Load and register the database driver using ClassLoader Simple Example (2) Connect to a database Create SQL statement object DB-related processes Close SQL statement object and connection Unregister the driver SEVERE: The web application [/this-context] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. CS 4640

Simple Example (select) Prepare a query Execute a query and store all rows retrieved in a ResultSet object More rows? Access a value of column “user_id” Close a ResultSet object By default, a ResultSet object is read-only and has a cursor that moves forward only, i.e., next(). CS 4640

Simple Example (create table) Prepare a query Execute a query to create a table Successfully create a table? CS 4640

Simple Example (insert) Prepare a query Execute a query to insert information into a table Successfully insert information? CS 4640

Simple Example (update) Prepare a query Execute a query to update information Successfully update information? By careful !! update without a “where” clause will update all rows in the table CS 4640

Simple Example (delete) Prepare a query Execute a query to update information Successfully update information? By careful !! delete from student; or delete * from student; will delete all rows in the table CS 4640

JDBC Summary Most large web apps use databases to make data persistent The techniques for accessing databases from Java programs are identical in web apps as in stand-alone Java programs Read further for information on how to set up, use a database, and how to construct SQL queries CS 4640