JDBC Dr Jim Briggs. WEBP JDBC2 JDBC Java Database Connectivity An API for connecting Java programs (applications, applets and servlets) to databases Largely.

Slides:



Advertisements
Similar presentations
Persistence Jim Briggs 1. 2 Database connectivity: JDBC Java Database Connectivity An API for connecting Java programs (applications, applets and servlets)
Advertisements

Introduction to JDBC Standard framework for dealing with tabular and generally, relational data SQL (Structured Query Language) is standardized language.
JDBC. Java Database Connectivity (JDBC) Use the java.sql package to query and update the database. JDBC is an API that allows java to communicate with.
Distributed Application Development B. Ramamurthy.
Fundamentals, Design, and Implementation, 9/e Chapter 14 JDBC, Java Server Pages, and MySQL.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
SQL (Structured Query Language) X/OPEN Call Level Interface For SQL ODBC (Open DataBase Connectivity) API JDBC (Java DataBase Connectivity) API SQL (Structured.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Java Database Connectivity (JDBC) java.sql package to query and update the database. JDBC is an API that allows java to communicate with a database server.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
1 Lecture 29 More on JDBC Overview  Objectives of this lecture  JDBC and its Drivers  Connecting to Databases (Java’s Connection class)  Querying a.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
Murali Mani Web Interface. Murali Mani Options PHP with mySQL JSP/Servlets with JDBC on mySQL/Oracle Others …
Basic JDBC Use Oracle JDBC Drivers must be in the CLASSPATH
Java Server Programming Jeff Schmitt Towson University October 15, 1998.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 11. DATABASE CONNECTIVITY IN JAVA JDBC Programming JDBC (Java Database Connectivity) is the specification of a.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Introduction to JDBC (Java Database Connectivity).
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
Think Possibility Integrating Web Applications With Databases.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
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.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
JDBC. JDBC Drivers JDBC is an alternative to ODBC and ADO that provides database access to programs written in Java.
Standalone Java Application vs. Java Web Application
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.
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.
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.
COMP201 Java Programming Topic 15: Database Connectivity JDBC Reading: Chapter 4, Volume 2.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
JDBC Establish a connection with a database or access any tabular data source Send SQL statements Process the results Two major sets of interfaces: JDBC.
Computer Science [3] Java Programming II - Laboratory Course Lab 9: Accessing Databases with JDBC Instructions on Setting Accesses Connecting to and Querying.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
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
JDBC (Java Database Connectivity)
JDBC - Java Database Connectivity. JDBC provides Java applications with access to most database systems via SQL The architecture and API closely resemble.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
1 Download current version of Tomcat from: g/tomcat/ g/tomcat/ Install it in: C:\Program Files\Apache.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Using Oracle JDBC How to Run JDBC on Your Account Communication Mechanism Using Metadata Building a Database Auto Commit v.s Atomic Transaction.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
JDBC and OCCI 10/29/2017.
Database: JDBC Overview
DEPTT. OF COMP. SC & APPLICATIONS
CS3220 Web and Internet Programming Database Access with JDBC
Web Technologies IT230 Dr Mohamed Habib.
CS320 Web and Internet Programming Database Access with JDBC
Database JDBC Overview CS Programming Languages for Web Applications
Advanced Web Automation Using Selenium
Content: What is JMeter? What can I do with JMeter?
JDBC – ODBC DRIVERS.
MSIS 655 Advanced Business Applications Programming
Java Database Connectivity
Java API for Database Connectivity
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Presentation transcript:

JDBC Dr Jim Briggs

WEBP JDBC2 JDBC Java Database Connectivity An API for connecting Java programs (applications, applets and servlets) to databases Largely database independent –Requires SQL

WEBP JDBC3 JDBC architecture

WEBP JDBC4 Using JDBC Obtaining drivers Making a connection Executing a command –Statements –Result sets

WEBP JDBC5 Obtaining drivers Usually provided (free) by database vendors Common ones –oracle.jdbc.driver.OracleDriver –com.mysql.jdbc.Driver –sun.jdbc.odbc.JdbcOdbcDriver Need to download and install –In a webapp, put the Jar file in WEB-INF/lib

WEBP JDBC6 Connecting to a database Via a DriverManager (old) –Class.forName(DriverClassName).newInstance(); –Connection con = DriverManager.getConnection(URL,Username,Password); Via a DataSource (new) –Create DataSource object in configuration, e.g. in Tomcat’s context.xml file in an application server's environment

WEBP JDBC7 Connection URLs JDBC has a special form of URL Define location of database and access parameters in a driver-specific way Examples: –jdbc:mysql://localhost:3306/JIM

WEBP JDBC8 Doing a query Statement stmt = conn.createStatement(); ResultSet result = stmt.executeQuery( "SELECT Entry, Customer, DOW, Cups, Type " + "FROM JJJJData " + "ORDER BY Cups DESC“ ); while(result.next()) { out.println(result.getString(1)); out.println(result.getInt(“Cups”); }

WEBP JDBC9 Further features Prepared statements Bind variables Transactions

WEBP JDBC10 JDBC and web applications Special considerations –Connection latency –Connection pooling –Multiple connections –One connection per thread (request) –One transaction per request (normally)