My_Demo_Test : Air –Pollution measured at certain time points in a day t0t1t2t3t4 4548556560 4352576361 4042575556 3536474641 3637495048 65 63 57 47 50.

Slides:



Advertisements
Similar presentations
5 Copyright © 2005, Oracle. All rights reserved. Accessing the Database with Servlets.
Advertisements

16 Copyright © 2005, Oracle. All rights reserved. Using JDBC to Access the Database.
Copyright  Oracle Corporation, All rights reserved. 2 Java and Databases: An Overview.
SQL*PLUS, PLSQL and SQLLDR Ali Obaidi. SQL Advantages High level – Builds on relational algebra and calculus – Powerful operations – Enables automatic.
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.
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.
EmbeddedSQL: 1 Impedance Mismatch Problem Problem : How to connect SQL statements with conventional programming languages Different models of language.
Sql*Plus Oracle Server ResultQuery, Procedure Call.
JDBC CS 122. JDBC zJava Database Connectivity zDatabase Access Interface Õprovides access to a relational database (by allowing SQL statements to be sent.
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).
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
Overview of JDBC and Pro*C 1 Overview of JDBC,Pro*C and Oracle connectivity on Omega CSE 5330 – Database Systems.
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
Java Utility Classes CS 21b. Some Java Utility Classes Vector Hashtable StringTokenizer * import java.util.*;
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Application Development Chapter 6.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
Overview of JDBC and Pro*C 1 CSE 5330 – Database Systems.
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.
 What software components are required?  How do I install the Oracle JDBC driver?  How do I connect to the database?  What form is the data in and.
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
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.
Advanced SQL: Cursors & Stored Procedures
JDBC. Preliminaries Database Database Collection of data Collection of data DBMS DBMS Database management system Database management system Stores and.
JDBC Enterprise Systems Programming. JDBC  Java Database Connectivity  Database Access Interface provides access to a relational database (by allowing.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
JDBC – Java Database Concentricity
ICS 321 Fall 2009 DBMS Application Programming Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 10/06/20091Lipyeow.
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.
Chapter 17 Accessing Databases with JDBC. JDBC JDBC provides a standard library for accessing relational databases. By using the JDBC API, you can access.
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.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
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.
16 Java Database Connectivity. 2 Understand the JDBC Understand the steps of the JDBC: 1.) Importing packages 2.) Opening a connection to a database 3.)
JDBC and SQLJ CIS 612 Spring JDBC JDBC is an API that enables database access from Java programs JDBC for DB access provides ◦ Portability across.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Application Development Chapter 6.
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)
SCU Fall 2002JoAnne Holliday10–1 Schedule Today u Triggers, Procedures, PL/SQL. u Read Sections , 8.1, 8.5. Next u Transaction concepts, security.
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.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Application Development Chapter 6.
JSP and DB.
Database: JDBC Overview
1st Semester, 2017 Sanghyun Park
Database JDBC Overview CS Programming Languages for Web Applications
Advanced Web Automation Using Selenium
Database Application Development
JDBC.
Design and Implementation of Software for the Web
Objectives In this lesson, you will learn about:
Interacting with Database
JDBC – ODBC DRIVERS.
DB Programming: SQL Programming Techniques
MSIS 655 Advanced Business Applications Programming
JAVA DATABaSE CONNECTIVITY
JDBC Example.
Database Application Development
Presentation transcript:

My_Demo_Test : Air –Pollution measured at certain time points in a day t0t1t2t3t Results t0t1t2t3t When is the highest pollution?

Client (Java, JDBC) DB Server Oracle Table : My_Demo_Tes t... Return table data (cursor) Select * From My_Demo_Test ; Data is processed at client side Thick Client : Business logic resides at client

Int maxPos() { … } Int main() { … EXEC SQL BEGIN DECLARE SECTION; charszServerDatabase[(SQLID_MAX * 2)+2] = “dbname"; charszLoginPassword[(SQLID_MAX * 2)+2] = “uname.password"; intt0, t1, t2, t3, t4 ; EXEC SQL END DECLARE SECTION; … EXEC SQL CONNECT TO :szServerDatabase USER :szLoginPassword; … EXEC SQL DECLARE C1 CURSOR FOR SELECT * FROM my_demo_test; EXEC SQL OPEN C1 ; … EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; while (SQLCODE == 0) { Pos = maxPos(t0, t1, t2, t3, t4); PosCount[Pos] = PosCount[Pos] + 1; EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; } }

Client (Sql*plus) DB Server Oracle Package isk_demo { MaxPos() ; PosCount() ; } Table : My_Demo_Tes t... Result s Executing sp… Call isk_demo.PosCount() ; Package isk_demo { MaxPos() ; PosCount() ; } Thin Client : Business logic resides at server

Sql*Plus Oracle Server ResultQuery, Procedure Call

Create Or Replace Package isk_demo As Function MaxPos(t1 Float, t2 Float, t3 Float, t4 Float, t5 Float) Return Integer ; Procedure PosCount ; End isk_demo ; Create Or Replace Package Body isk_demo As End isk_demo ;

Create Or Replace Package Body isk_demo As Function MaxPos(…) Return Integer End MaxPos ; Procedure PosCount As Cursor rSet Is Select * From My_Demo_Test ; … Begin For rSetRow In rSet Loop I := MaxPos(rSetRow.t0, rSetRow.t1, rSetRow.t2, rSetRow.t3, rSetRow.t4) ; PosCountArray(I) := PosCountArray(I) + 1 ; End Loop ; End PosCount ; End isk_demo ;

class Luft {// stands for "Luftverschmutzungsstatistik“ int MaxPos(float t0, float t1, float t2, float t3, float t4) { } void main () { // Load the Oracle JDBC driver DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); // Connect to the database : : Connection conn = DriverManager.getConnection "iskXX", "*****"); // Select the complete table ResultSet rset = stmt.executeQuery ("SELECT * FROM My_Demo_Test");... while (rset.next ()) { Pos = MaxPos(); PosCount[Pos] = PosCount[Pos] + 1; } }