Client Access, Queries, Stored Procedures, JDBC

Slides:



Advertisements
Similar presentations
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
Advertisements

Java Database Connectivity (JDBC). 2/24 JDBC (Java DataBase Connectivity) - provides access to relational database systems JDBC is a vendor independent.
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.
CSE470 Software Engineering Fall Database Access through Java.
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
Java Database Connectivity (JDBC) Francisco Pajaro Saul Acosta Nahum Quezada Manuel Rubio.
Overview of JDBC and Pro*C 1 Overview of JDBC,Pro*C and Oracle connectivity on Omega CSE 5330 – Database Systems.
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.
CSE470 Software Engineering Fall Database Access through Java.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Database Programming in Java Corresponds with Chapter 32, 33.
JDBC. JDBC Drivers JDBC is an alternative to ODBC and ADO that provides database access to programs written in Java.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
CS 405G: Introduction to Database Systems Database programming.
Overview of JDBC and Pro*C 1 CSE 5330 – Database Systems.
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 Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
Java Database Connectivity. Java and the database Database is used to store data. It is also known as persistent storage as the data is stored and can.
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 CS 124. JDBC Java Database Connectivity Database Access Interface provides access to a relational database (by allowing SQL statements to be sent.
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.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
WEB SECURITY WEEK 2 Computer Security Group University of Texas at Dallas.
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 Session 14.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
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.
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.
JDBC I IS Why do we have databases?
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.
CS422 Principles of Database Systems JDBC and Embedded SQL Chengyu Sun California State University, Los Angeles.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
JDBC Statements The JDBC Statement, CallableStatement, and PreparedStatement interfaces define the methods and properties that enables to send SQL or PL/SQL.
JDBC. Database is used to store data permanently. These days almost all Applications needs database to store its data persistently. Below are the most.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Application Development Chapter 6.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Instructor: Jinze Liu Fall /8/2016Jinze University of Kentucky 2 Database Project Database Architecture Database programming.
Database: JDBC Overview
CS3220 Web and Internet Programming Database Access with JDBC
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.
Lec - 14.
Databases.
ODBC, OCCI and JDBC overview
JDBC Database Management Database connectivity
CS320 Web and Internet Programming Database Access with JDBC
Database JDBC Overview CS Programming Languages for Web Applications
Advanced Web Automation Using Selenium
Using SQL Server through Command Prompt
HW#4 Making Simple BBS Using JDBC
Prof: Dr. Shu-Ching Chen TA: Sheng Guan
Interacting with Database
JAVA DATABaSE CONNECTIVITY
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Java Chapter 6 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Client Access, Queries, Stored Procedures, JDBC CS 433 DB2 Overview Client Access, Queries, Stored Procedures, JDBC 9/12/01 Jeff Derstadt & Megha Batra

Administration Project Proposals Due 09/14/01 by 5PM Email them to TAs Please register your group on the web http://www.cs.cornell.edu/courses/cs433/2001fa/

Client Configuration Must setup a client-server connection Server name: egret.csuglab.cornell.edu Port: 50000 Database name: Your group (g7, g23, etc.)

Client Configuration Let’s configure our client!

Command Line Queries Connect to database Issue queries Connect to <database_name> user <user_name> using <password> Issue queries CREATE TABLE <table> (<column_name> <datatype>, …) INSERT INTO <table> values (…) SELECT <columns> from <table>

Command Line Queries Let’s issue some queries!

Stored Procedures Definition: Examples: A set of SQL and programming language (C++/Java) statements that are compiled into a named database object that can be invoked by a user application Examples: For each sailor with a rating less than 5, insert her into the “NeedsTraining” table, and email her requesting that she sign up for additional instruction Converting relational tables to Xml

Stored Procedures (2) Advantages Can embed SQL in a ‘native’ programming language Executed on the database server: no network delay Compiled procedures can be invoked by any user application Provides consistent functionality (don’t need to rewrite SQL ‘inserts’, can just call a stored procedure)

Java DB2 allows you to write stored procedures in Java + Java is an easy language - Must use some sort of bridge between the native DB2 code and the Java Virtual Machine to transfer data from a relational table to the stored procedure +/- JDBC provides this bridge: extra copy, but easy access

DB2 to Java 3 1 2 Java Virtual Machine Int sid = rs.getInt(1); String name = rs.getString(2); 3 ResultSet rs; Result extracted from JDBC DB2 (C++) SID=5, NAME=Sarah Query Result 1 JDBC (Java Database Connection) 2 Copy from DB2 to JDBC storage

JDBC java.sql.* Using JDBC adds additional costs However Copy from DB2 to JDBC ResultSet object (2) Copy from ResultSet object to another Java variable (sometimes at 3) However JDBC makes issuing SQL queries and gathering results very easy

JDBC ResultSet Provides a simple cursor object A cursor is a set-of-records abstraction that allows you to move from one row to the next and access the columns: SID NAME rs.next() rs.getString(2) 12 Sarah 13 Joe 15 Megha

Stored Procedures Let’s write a stored procedure that converts a table to Xml!

Questions ??