API Example. API Example

Size: px
Start display at page:

Download "API Example. API Example"

Transcription

1 License Database Systems Application Development H. Turgut Uyar Şule Öğüdücü You are free: to Share to copy, distribute and transmit the work to Remix to adapt the work c T. Uyar, Ş. Öğüdücü Under the following conditions: Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial You may not use this work for commercial purposes. Share Alike If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. 1 / 55 2 / 55 Topics Introduction Application Development Introduction Embedded SQL ODBC JDBC SQL Facilities Stored Procedures Views Permissions Performance using the database language in conjunction with a general-purpose programming language general-purpose language: host language mismatch between SQL and the host language: SQL operations on sets iteration constructs in programming languages 3 / 55 4 / 55 Program Structure Approaches connect server, database, username, password as necessary: execute a query iterate over the result set application programming interface (API) embedded SQL ODBC language standard interfaces disconnect 5 / 55 6 / 55

2 Application Programming Interface API Example Example (PostgreSQL - C) using the library functions of the SQL server pros and cons: fast not standard #include <l i b p q f e. h> i n t main ( void ) { / connect / / e x e c u t e query / / d i s c o n n e c t / 7 / 55 8 / 55 API Example API Example Example (connecting) / PGconn conn ; / conn = PQconnectdb ( h o s t=l o c a l h o s t dbname=imdb u s e r=i t u c s password=i t u c s ) ; i f ( PQstatus ( conn ) == CONNECTION BAD) { f p r i n t f ( s t d e r r, Connection f a i l e d. \ n ) ; e x i t ( 1 ) ; / e x e c u t e query / P Q f i n i s h ( conn ) ; Example (executing a query) / P G r e s u l t r e s u l t ; / s p r i n t f ( query, SELECT TITLE, SCORE FROM MOVIE WHERE (YR = %d ), y e a r ) ; r e s u l t = PQexec ( conn, query ) ; i f ( P Q r e s u l t S t a t u s ( r e s u l t )!= PGRES TUPLES OK) { f p r i n t f ( s t d e r r, Query f a i l e d. \ n ) ; PQclear ( r e s u l t ) ; P Q f i n i s h ( conn ) ; e x i t ( 1 ) ; 9 / / 55 API Example Embedded SQL Example (processing the result set) f o r ( i = 0 ; i < PQntuples ( r e s u l t ) ; i ++) p r i n t f ( %s %s \n, PQgetvalue ( r e s u l t, i, 0 ), PQgetvalue ( r e s u l t, i, 1 ) ) ; PQclear ( r e s u l t ) ; stages: 1. mark SQL statements within host language code: EXEC SQL 2. embedded SQL preprocessor: embedded SQL directives API calls 3. host language compiler pros and cons: fast, standard difficult, does not support most languages skip Embedded SQL 11 / / 55

3 Embedded SQL Embedded SQL Standard sharing variables with the host language error control adapting query results 13 / / 55 Variable Sharing Error Control Syntax EXEC SQL BEGIN DECLARE SECTION; s h a r e d v a r i a b l e s EXEC SQL END DECLARE SECTION; in SQL statements: : in front of host language variables Error Processing EXEC SQL WHENEVER { SQLERROR SQLWARNING NOT FOUND { STOP CONTINUE DO command GOTO l a b e l 15 / / 55 Adapting Query Results Embedded SQL Example Cursors EXEC SQL DECLARE cursor name CURSOR FOR SELECT... EXEC SQL OPEN cursor name ; EXEC SQL FETCH IN cursor name INTO v a r i a b l e s ; EXEC SQL CLOSE cursor name ; query is not executed when cursor is defined it is executed when cursor is opened cursor points to first element in the result set Example (connecting) EXEC SQL BEGIN DECLARE SECTION ; i n t y r ; char t i t l e = NULL, s c o r e = NULL ; EXEC SQL END DECLARE SECTION ; EXEC SQL CONNECT TO i t u c s USER i t u c s IDENTIFIED BY i t u c s ; / p r o c e s s query / EXEC SQL DISCONNECT ; 17 / / 55

4 Embedded SQL Example Embedded SQL Example Example (processing query) s c a n f ( %d, &y r ) ; EXEC SQL DECLARE c q u e r y CURSOR FOR SELECT TITLE, SCORE FROM MOVIE WHERE (YR = : y r ) ; EXEC SQL OPEN c q u e r y ; / e x e c u t e query / EXEC SQL CLOSE c q u e r y ; EXEC SQL COMMIT; Example (executing query) EXEC SQL WHENEVER NOT FOUND DO break ; while ( 1 ) { EXEC SQL FETCH c q u e r y INTO : t i t l e, : s c o r e ; p r i n t f ( %s %s \n, t i t l e, s c o r e ) ; t i t l e = s c o r e = NULL ; f r e e ( t i t l e ) ; f r e e ( s c o r e ) ; 19 / / 55 ODBC ODBC Architecture ODBC: Open DataBase Connectivity: a service layer between the application and the server pros and cons: standard very slow application driver manager registers the ODBC drivers transfers requests from application to driver driver translates and transfers requests to data source data source processes instructions from the driver 21 / / 55 ODBC Example ODBC Example Example (PHP) $conn = odbc connect ( imdb, i t u c s, i t u c s ) ; $query = SELECT TITLE, SCORE FROM MOVIE WHERE (YR =. $ y e a r. ) ; $ r e s u l t = odbc exec ( $conn, $query ) ; / p r o c e s s the r e s u l t s e t / odbc close ( $conn ) ; Example (processing the result set) echo <t a b l e >\n ; while ( odbc fetch row ( $ r e s u l t ) ) { $ t i t l e = o d b c r e sult ( $ r e s u l t, t i t l e ) ; $ s c o r e = o d b c r e sult ( $ r e s u l t, s c o r e ) ; echo <tr >\n ; echo <td>$ t i t l e </td >\n ; echo <td>$score </td >\n ; echo </tr >\n ; echo </t a b l e >\n ; 23 / / 55

5 JDBC JDBC Drivers JDBC: Java DataBase Connectivity same architectural concepts as in ODBC different types of drivers JDBC URL for connection jdbc:<subprotocol>:<otherparameters> matching Java and SQL data types Type I: bridges translate into non-native calls (for example ODBC) Type II: direct translation via non-java driver translate into API of data source (for example C++) Type III: network bridges connect to middleware server for translating into API of data source Type IV: direct translation via Java driver communicate with DBMS through Java sockets 25 / / 55 JDBC Package JDBC Connection import the JDBC package: import java. sql. exception about SQL operations: SQLException DriverManager: connection manager getconnection (static) Connection: database connection createstatement 27 / / 55 JDBC Queries Java and SQL Data Types Statement: SQL statement executequery: for query operations executeupdate: for insert/update/delete operations PreparedStatement: precompiled SQL statement can be used multiple times placeholder for parameters:? set value before invoking query ResultSet: set of query results next: next element in the result set methods for getting the data in appropriate type SQL type Java class ResultSet method BIT Boolean getboolean() CHAR String getstring() VARCHAR String getstring() DOUBLE Double getdouble() FLOAT Float getdouble() INTEGER Integer getint() REAL Double getfloat() DATE java.sql.date getdate() TIME java.sql.time gettime() TIMESTAMP java.sql.timestamp gettimestamp() 29 / / 55

6 JDBC Example JDBC Example Example (checking the database driver) t r y { C l a s s. forname ( org. p o s t g r e s q l. D r i v e r ) ; catch ( ClassNotFoundException e ) { // PostgreSQL d r i v e r not i n s t a l l e d Example (connecting) t r y { Connection conn = DriverManager. g e t C o n n e c t i o n ( j d b c : p o s t g r e s q l : imdb, i t u c s, i t u c s ) ; catch ( SQLException e ) { // c o n n e c t i o n e r r o r 31 / / 55 JDBC Example JDBC Example Example (executing query) Statement stmt = conn. c r e a t e S t a t e m e n t ( ) ; S t r i n g query = SELECT TITLE, SCORE FROM MOVIE + WHERE (YR = 1990) ; R e s u l t S e t r e s u l t = stmt. executequery ( query ) ; while ( r e s u l t. next ( ) ) System. out. p r i n t l n ( r e s u l t. g e t S t r i n g ( 1 ) + + r e s u l t. g e t F l o a t ( 2 ) ) ; Example (prepared statement) S t r i n g query = DELETE FROM MOVIE + WHERE (SCORE <?) ; PreparedStatement stmt = conn. p r e p a r e S t a t e m e n t ( query ) ; stmt. s e t F l o a t ( 1, s c o r e ) ; stmt. executeupdate ( ) ; 33 / / 55 References Stored Procedures Required text: Ramakrishnan, Gehrke Chapter 6: Database Application Development 6.1. Accessing Databases from Applications 6.2. An Introduction to JDBC 6.3. JDBC Classes and Interfaces Supplementary text: Date Chapter 4: An Introduction to SQL 4.6. Embedded SQL implementing functionality in the database server languages: SQL, PL/SQL, C,... not really recommended not portable database servers are not optimized for business logic implement business logic on the application server 35 / / 55

7 Creating Functions SQL Function Example SQL Statement CREATE FUNCTION f u n c t i o n n a m e ( [ type [,... ] ] ) RETURNS r e t u r n t y p e AS f u n c t i o n b o d y LANGUAGE language name first parameter $1, second parameter $2,... Example (calculating new score) $1: old score, $2: old votes, $3: new vote CREATE FUNCTION NEW SCORE( f l o a t, int, i n t ) RETURNS f l o a t AS SELECT ( $1 $2+$3 ) / ( $2 +1); LANGUAGE s q l 37 / / 55 Triggers Creating Triggers SQL Statement Definition trigger: a function that will be automatically activated on an event can be useful for maintaining integrity CREATE TRIGGER t r i g g e r n a m e { BEFORE AFTER { e v e n t [ OR... ] ON table name [ FOR [ EACH ] { ROW STATEMENT ] EXECUTE PROCEDURE function name (... ) PL/pgSQL: old: tuple before the operation new: tuple after the operation 39 / / 55 Trigger Example Trigger Example Example (keep a points column) CREATE FUNCTION UPDATE MOVIE POINTS ( ) RETURNS opaque AS BEGIN new. POINTS = new. SCORE new. VOTES; RETURN new ; END; LANGUAGE p l p g s q l Example (keep a points column) CREATE TRIGGER UPDATE MOVIE BEFORE INSERT OR UPDATE ON MOVIE FOR EACH ROW EXECUTE PROCEDURE UPDATE MOVIE POINTS ( ) 41 / / 55

8 Views Creating Views presenting a derived table like a base table isolating application programs from changes in database structure denormalizing after database refactoring SQL Statement CREATE VIEW view name AS SELECT... the SELECT query will be executed every time the view is used 43 / / 55 View Example Updating Views Example CREATE VIEW NEW MOVIE AS SELECT ID, TITLE, YR FROM MOVIE WHERE (YR > 1995) SELECT FROM NEW MOVIE changes have to performed on the base tables Creating Rules rules are needed CREATE RULE rule name AS ON e v e n t TO view name [ WHERE c o n d i t i o n ] DO [ INSTEAD ] s q l s t a t e m e n t 45 / / 55 View Rule Example Snapshots Example UPDATE NEW MOVIE SET TITLE=.. WHERE ( ID = 1) CREATE RULE UPDATE TITLE AS ON UPDATE TO NEW MOVIE DO INSTEAD UPDATE MOVIE SET TITLE = new. TITLE WHERE ( ID = o l d. ID ) similar to view but creates a new base table the query is executed only once when snapshot is created changes to base tables do not effect the snapshot no updates on the snapshot 47 / / 55

9 Creating Snapshots Permissions SQL Statement CREATE SNAPSHOT snapshot name AS SELECT... subject: active entities (user, group) object: passive entities (table, column, view,...) owner of object determines permissions of other subjects: discretionary access control 49 / / 55 SQL Permissions Permission Examples Granting Permissions GRANT p e rmission n a m e [,... ] ON object name TO s u b ject n a m e [ WITH GRANT OPTION ] Revoking Permissions REVOKE p e rmission n a m e ON object name FROM s u b ject n a m e Example (granting permissions on a table) GRANT SELECT, INSERT, UPDATE ON MOVIE TO i t u c s Example (granting permissions on a view) GRANT SELECT ON NEW MOVIES TO i t u c s Example (revoking permissions on a table) REVOKE INSERT ON MOVIE FROM i t u c s 51 / / 55 Indexes Indexes some operations require sorting: ORDER BY, DISTINCT, GROUP BY, UNION,... creating indexes can speed up queries slows and insert and update operations every key definition creates an index SQL Statement CREATE [ UNIQUE ] INDEX index name ON table name ( column name [,... ] ) 53 / / 55

10 References Required text: Date Chapter 9: Integrity Triggers (a Digression) Chapter 10: Views Chapter 17: Security Introduction SQL Facilities 55 / 55

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University CS 377 Database Systems SQL Programming Li Xiong Department of Mathematics and Computer Science Emory University 1 A SQL Query Joke A SQL query walks into a bar and sees two tables. He walks up to them

More information

Why Is This Important? Database Application Development. SQL in Application Code. Overview. SQL in Application Code (Contd.

Why Is This Important? Database Application Development. SQL in Application Code. Overview. SQL in Application Code (Contd. Why Is This Important? Database Application Development Chapter 6 So far, accessed DBMS directly through client tools Great for interactive use How can we access the DBMS from a program? Need an interface

More information

JDBC (Java / SQL Programming) CS 377: Database Systems

JDBC (Java / SQL Programming) CS 377: Database Systems JDBC (Java / SQL Programming) CS 377: Database Systems JDBC Acronym for Java Database Connection Provides capability to access a database server through a set of library functions Set of library functions

More information

COSC344 Database Theory and Applications. Java and SQL. Lecture 12

COSC344 Database Theory and Applications. Java and SQL. Lecture 12 COSC344 Database Theory and Applications Lecture 12: Java and SQL COSC344 Lecture 12 1 Last Lecture Trigger Overview This Lecture Java & SQL Source: Lecture notes, Textbook: Chapter 12 JDBC documentation

More information

Database Programming. Week 10-2. *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford

Database Programming. Week 10-2. *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford Database Programming Week 10-2 *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford SQL in Real Programs We have seen only how SQL is used at the generic query

More information

Overview. Database Application Development. SQL in Application Code (Contd.) SQL in Application Code. Embedded SQL. Embedded SQL: Variables

Overview. Database Application Development. SQL in Application Code (Contd.) SQL in Application Code. Embedded SQL. Embedded SQL: Variables Overview Database Application Development Chapter 6 Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures Database Management Systems 3ed,

More information

Database Application Development. Overview. SQL in Application Code. Chapter 6

Database Application Development. Overview. SQL in Application Code. Chapter 6 Database Application Development Chapter 6 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic

More information

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language: Database Access from a Programming Language Database Access from a Programming Language: Java s JDBC Werner Nutt Introduction to Databases Free University of Bozen-Bolzano 2 Database Access from a Programming Language Two Approaches 1. Embedding

More information

Database Access from a Programming Language:

Database Access from a Programming Language: Database Access from a Programming Language: Java s JDBC Werner Nutt Introduction to Databases Free University of Bozen-Bolzano 2 Database Access from a Programming Language Two Approaches 1. Embedding

More information

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today. & & 1 & 2 Lecture #7 2008 3 Terminology Structure & & Database server software referred to as Database Management Systems (DBMS) Database schemas describe database structure Data ordered in tables, rows

More information

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn Chapter 9 Java and SQL Wang Yang wyang@njnet.edu.cn Outline Concern Data - File & IO vs. Database &SQL Database & SQL How Connect Java to SQL - Java Model for Database Java Database Connectivity (JDBC)

More information

CS346: Database Programming. http://warwick.ac.uk/cs346

CS346: Database Programming. http://warwick.ac.uk/cs346 CS346: Database Programming http://warwick.ac.uk/cs346 1 Database programming Issue: inclusionofdatabasestatementsinaprogram combination host language (general-purpose programming language, e.g. Java)

More information

Java and Databases. COMP514 Distributed Information Systems. Java Database Connectivity. Standards and utilities. Java and Databases

Java and Databases. COMP514 Distributed Information Systems. Java Database Connectivity. Standards and utilities. Java and Databases Java and Databases COMP514 Distributed Information Systems Java Database Connectivity One of the problems in writing Java, C, C++,, applications is that the programming languages cannot provide persistence

More information

Course Objectives. Database Applications. External applications. Course Objectives Interfacing. Mixing two worlds. Two approaches

Course Objectives. Database Applications. External applications. Course Objectives Interfacing. Mixing two worlds. Two approaches Course Objectives Database Applications Design Construction SQL/PSM Embedded SQL JDBC Applications Usage Course Objectives Interfacing When the course is through, you should Know how to connect to and

More information

SQL and Java. Database Systems Lecture 19 Natasha Alechina

SQL and Java. Database Systems Lecture 19 Natasha Alechina Database Systems Lecture 19 Natasha Alechina In this Lecture SQL in Java SQL from within other Languages SQL, Java, and JDBC For More Information Sun Java tutorial: http://java.sun.com/docs/books/tutorial/jdbc

More information

Programming Database lectures for mathema

Programming Database lectures for mathema Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$

More information

CS/CE 2336 Computer Science II

CS/CE 2336 Computer Science II CS/CE 2336 Computer Science II UT D Session 23 Database Programming with Java Adapted from D. Liang s Introduction to Java Programming, 8 th Ed. and other sources 2 Database Recap Application Users Application

More information

Porting from Oracle to PostgreSQL

Porting from Oracle to PostgreSQL by Paulo Merson February/2002 Porting from Oracle to If you are starting to use or you will migrate from Oracle database server, I hope this document helps. If you have Java applications and use JDBC,

More information

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications Chapter 13 SQL Programming Introduction to SQL Programming Techniques Database applications Host language Java, C/C++/C#, COBOL, or some other programming language Data sublanguage SQL SQL standards Continually

More information

What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC?

What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC? What is ODBC? Database Connectivity ODBC, JDBC and SQLJ CS2312 ODBC is (Open Database Connectivity): A standard or open application programming interface (API) for accessing a database. SQL Access Group,

More information

1 SQL Data Types and Schemas

1 SQL Data Types and Schemas COMP 378 Database Systems Notes for Chapters 4 and 5 of Database System Concepts Advanced SQL 1 SQL Data Types and Schemas 1.1 Additional Data Types 1.1.1 User Defined Types Idea: in some situations, data

More information

The JAVA Way: JDBC and SQLJ

The JAVA Way: JDBC and SQLJ The JAVA Way: JDBC and SQLJ David Toman School of Computer Science University of Waterloo Introduction to Databases CS348 David Toman (University of Waterloo) JDBC/SQLJ 1 / 21 The JAVA way to Access RDBMS

More information

More SQL: Assertions, Views, and Programming Techniques

More SQL: Assertions, Views, and Programming Techniques 9 More SQL: Assertions, Views, and Programming Techniques In the previous chapter, we described several aspects of the SQL language, the standard for relational databases. We described the SQL statements

More information

Self-test Database application programming with JDBC

Self-test Database application programming with JDBC Self-test Database application programming with JDBC Document: e1216test.fm 18/04/2012 ABIS Training & Consulting P.O. Box 220 B-3000 Leuven Belgium TRAINING & CONSULTING INTRODUCTION TO THE SELF-TEST

More information

CS2506 Operating Systems II Lab 8, 8 th Tue/03 /2011 Java API

CS2506 Operating Systems II Lab 8, 8 th Tue/03 /2011 Java API Introduction The JDBC API was designed to keep simple things simple. This means that the JDBC makes everyday database tasks easy. In this lab you will learn about how Java interacts with databases. JDBC

More information

database abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia smith@backendmedia.com

database abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia smith@backendmedia.com Lukas Smith database abstraction layers in PHP BackendMedia 1 Overview Introduction Motivation PDO extension PEAR::MDB2 Client API SQL syntax SQL concepts Result sets Error handling High level features

More information

Supplement IV.D: Tutorial for MS Access. For Introduction to Java Programming By Y. Daniel Liang

Supplement IV.D: Tutorial for MS Access. For Introduction to Java Programming By Y. Daniel Liang Supplement IV.D: Tutorial for MS Access For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Creating Databases and Executing SQL Creating ODBC Data Source

More information

Embedded SQL. Unit 5.1. Dr Gordon Russell, Copyright @ Napier University

Embedded SQL. Unit 5.1. Dr Gordon Russell, Copyright @ Napier University Embedded SQL Unit 5.1 Unit 5.1 - Embedde SQL - V2.0 1 Interactive SQL So far in the module we have considered only the SQL queries which you can type in at the SQL prompt. We refer to this as interactive

More information

SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema:

SQL Programming. CS145 Lecture Notes #10. Motivation. Oracle PL/SQL. Basics. Example schema: CS145 Lecture Notes #10 SQL Programming Example schema: CREATE TABLE Student (SID INTEGER PRIMARY KEY, name CHAR(30), age INTEGER, GPA FLOAT); CREATE TABLE Take (SID INTEGER, CID CHAR(10), PRIMARY KEY(SID,

More information

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

LSINF1124 Projet de programmation

LSINF1124 Projet de programmation LSINF1124 Projet de programmation Database Programming with Java TM Sébastien Combéfis University of Louvain (UCLouvain) Louvain School of Engineering (EPL) March 1, 2011 Introduction A database is a collection

More information

SQL: Programming. Introduction to Databases CompSci 316 Fall 2014

SQL: Programming. Introduction to Databases CompSci 316 Fall 2014 SQL: Programming Introduction to Databases CompSci 316 Fall 2014 2 Announcements (Tue., Oct. 7) Homework #2 due today midnight Sample solution to be posted by tomorrow evening Midterm in class this Thursday

More information

JDBC. It is connected by the Native Module of dependent form of h/w like.dll or.so. ex) OCI driver for local connection to Oracle

JDBC. It is connected by the Native Module of dependent form of h/w like.dll or.so. ex) OCI driver for local connection to Oracle JDBC 4 types of JDBC drivers Type 1 : JDBC-ODBC bridge It is used for local connection. ex) 32bit ODBC in windows Type 2 : Native API connection driver It is connected by the Native Module of dependent

More information

Making Oracle and JDBC Work For You

Making Oracle and JDBC Work For You Making Oracle and JDBC Work For You Presented to: TOUG DBA/Developer Day 2004 October 25, 2004 John Jay King King Training Resources john@kingtraining.com Download this paper and code examples from: http://www.kingtraining.com

More information

DEVELOPING MULTITHREADED DATABASE APPLICATION USING JAVA TOOLS AND ORACLE DATABASE MANAGEMENT SYSTEM IN INTRANET ENVIRONMENT

DEVELOPING MULTITHREADED DATABASE APPLICATION USING JAVA TOOLS AND ORACLE DATABASE MANAGEMENT SYSTEM IN INTRANET ENVIRONMENT DEVELOPING MULTITHREADED DATABASE APPLICATION USING JAVA TOOLS AND ORACLE DATABASE MANAGEMENT SYSTEM IN INTRANET ENVIRONMENT Raied Salman Computer Information Science, American College of Commerce and

More information

Java DataBase Connectivity (JDBC)

Java DataBase Connectivity (JDBC) Java DataBase Connectivity (JDBC) Plan Presentation of JDBC JDBC Drivers Work with JDBC Interfaces and JDBC classes Exceptions SQL requests Transactions and exceptions 1 Presentation JDBC (Java Data Base

More information

Using SQL Server Management Studio

Using SQL Server Management Studio Using SQL Server Management Studio Microsoft SQL Server Management Studio 2005 is a graphical tool for database designer or programmer. With SQL Server Management Studio 2005 you can: Create databases

More information

SQL and Programming Languages. SQL in Programming Languages. Applications. Approaches

SQL and Programming Languages. SQL in Programming Languages. Applications. Approaches SQL and Programming Languages SQL in Programming Languages Read chapter 5 of Atzeni et al. BD: Modelli e Linguaggi di Interrogazione and section 8.4 of Garcia-Molina The user does not want to execute SQL

More information

Real SQL Programming. Embedded SQL Call-Level Interface Java Database Connectivity

Real SQL Programming. Embedded SQL Call-Level Interface Java Database Connectivity Real SQL Programming Embedded SQL Call-Level Interface Java Database Connectivity 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface --- an environment where we sit

More information

FileMaker 14. ODBC and JDBC Guide

FileMaker 14. ODBC and JDBC Guide FileMaker 14 ODBC and JDBC Guide 2004 2015 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and FileMaker Go are trademarks of FileMaker,

More information

Database Migration from MySQL to RDM Server

Database Migration from MySQL to RDM Server MIGRATION GUIDE Database Migration from MySQL to RDM Server A Birdstep Technology, Inc. Raima Embedded Database Division Migration Guide Published: May, 2009 Author: Daigoro F. Toyama Senior Software Engineer

More information

Real SQL Programming 1

Real SQL Programming 1 Real 1 We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional programs

More information

TABLE OF CONTENTS...2 INTRODUCTION...3 APPLETS AND APPLICATIONS...3 JAVABEANS...4 EXCEPTION HANDLING...5 JAVA DATABASE CONNECTIVITY (JDBC)...

TABLE OF CONTENTS...2 INTRODUCTION...3 APPLETS AND APPLICATIONS...3 JAVABEANS...4 EXCEPTION HANDLING...5 JAVA DATABASE CONNECTIVITY (JDBC)... Advanced Features Trenton Computer Festival May 1 sstt & 2 n d,, 2004 Michael P.. Redlich Senior Research Technician ExxonMobil Research & Engineering michael..p..redlich@exxonmobil..com Table of Contents

More information

Mimer SQL. Programmer s Manual. Version 8.2 Copyright 2000 Mimer Information Technology AB

Mimer SQL. Programmer s Manual. Version 8.2 Copyright 2000 Mimer Information Technology AB Mimer SQL Version 8.2 Copyright 2000 Mimer Information Technology AB Second revised edition December, 2000 Copyright 2000 Mimer Information Technology AB. Published by Mimer Information Technology AB,

More information

SQL is capable in manipulating relational data SQL is not good for many other tasks

SQL is capable in manipulating relational data SQL is not good for many other tasks Embedded SQL SQL Is Not for All SQL is capable in manipulating relational data SQL is not good for many other tasks Control structures: loops, conditional branches, Advanced data structures: trees, arrays,

More information

Applets, RMI, JDBC Exam Review

Applets, RMI, JDBC Exam Review Applets, RMI, JDBC Exam Review Sara Sprenkle Announcements Quiz today Project 2 due tomorrow Exam on Thursday Web programming CPM and servlets vs JSPs Sara Sprenkle - CISC370 2 1 Division of Labor Java

More information

Database Access Through Java Technologies

Database Access Through Java Technologies Database Systems Journal vol. 1, no. 1/2010 9 Database Access Through Java Technologies Ion LUNGU, Nicolae MERCIOIU Faculty of Cybernetics, Statistics and Economic Informatics, Academy of Economic Studies,

More information

DATABASDESIGN FÖR INGENJÖRER - 1DL124

DATABASDESIGN FÖR INGENJÖRER - 1DL124 1 DATABASDESIGN FÖR INGENJÖRER - 1DL124 Sommar 2007 En introduktionskurs i databassystem http://user.it.uu.se/~udbl/dbt-sommar07/ alt. http://www.it.uu.se/edu/course/homepage/dbdesign/st07/ Kjell Orsborn

More information

How To Use The Database In Jdbc.Com On A Microsoft Gdbdns.Com (Amd64) On A Pcode (Amd32) On An Ubuntu 8.2.2 (Amd66) On Microsoft

How To Use The Database In Jdbc.Com On A Microsoft Gdbdns.Com (Amd64) On A Pcode (Amd32) On An Ubuntu 8.2.2 (Amd66) On Microsoft CS 7700 Transaction Design for Microsoft Access Database with JDBC Purpose The purpose of this tutorial is to introduce the process of developing transactions for a Microsoft Access Database with Java

More information

Database Programming with PL/SQL: Learning Objectives

Database Programming with PL/SQL: Learning Objectives Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs

More information

Working With Derby. Version 10.2 Derby Document build: December 11, 2006, 7:06:09 AM (PST)

Working With Derby. Version 10.2 Derby Document build: December 11, 2006, 7:06:09 AM (PST) Working With Derby Version 10.2 Derby Document build: December 11, 2006, 7:06:09 AM (PST) Contents Copyright...3 Introduction and prerequisites...4 Activity overview... 5 Activity 1: Run SQL using the

More information

Abstract. Introduction. Web Technology and Thin Clients. What s New in Java Version 1.1

Abstract. Introduction. Web Technology and Thin Clients. What s New in Java Version 1.1 Overview of Java Components and Applets in SAS/IntrNet Software Barbara Walters, SAS Institute Inc., Cary, NC Don Chapman, SAS Institute Inc., Cary, NC Abstract This paper describes the Java components

More information

Package sjdbc. R topics documented: February 20, 2015

Package sjdbc. R topics documented: February 20, 2015 Package sjdbc February 20, 2015 Version 1.5.0-71 Title JDBC Driver Interface Author TIBCO Software Inc. Maintainer Stephen Kaluzny Provides a database-independent JDBC interface. License

More information

Embedded SQL programming

Embedded SQL programming Embedded SQL programming http://www-136.ibm.com/developerworks/db2 Table of contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Before

More information

Embedding SQL in High Level Language Programs

Embedding SQL in High Level Language Programs Embedding SQL in High Level Language Programs Alison Butterill IBM i Product Manager Power Systems Agenda Introduction Basic SQL within a HLL program Processing multiple records Error detection Dynamic

More information

FileMaker 12. ODBC and JDBC Guide

FileMaker 12. ODBC and JDBC Guide FileMaker 12 ODBC and JDBC Guide 2004 2012 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc.

More information

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation. Triggers & Packages An SQL trigger is a mechanism that automatically executes a specified PL/SQL block (referred to as the triggered action) when a triggering event occurs on the table. The triggering

More information

Seminar Datenbanksysteme

Seminar Datenbanksysteme University of Applied Sciences HTW Chur Master of Science in Engineering (MSE) Seminar Datenbanksysteme The LINQ-Approach in Java Student: Norman Süsstrunk Tutor: Martin Studer 18 th October 2010 Seminar

More information

FileMaker 11. ODBC and JDBC Guide

FileMaker 11. ODBC and JDBC Guide FileMaker 11 ODBC and JDBC Guide 2004 2010 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc. registered

More information

Database System Concepts

Database System Concepts Chapter 8(+4): Application Design and Development APIs Web Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2010/2011 Slides (fortemente) baseados nos slides oficiais do

More information

Writing MySQL Scripts With Python's DB-API Interface

Writing MySQL Scripts With Python's DB-API Interface Writing MySQL Scripts With Python's DB-API Interface By Paul DuBois, NuSphere Corporation (October 2001) TABLE OF CONTENTS MySQLdb Installation A Short DB-API Script Writing the Script Running the Script

More information

MAKING ORACLE AND SQLJ WORK FOR YOU John Jay King, King Training Resources

MAKING ORACLE AND SQLJ WORK FOR YOU John Jay King, King Training Resources MAKING ORACLE AND SQLJ WORK FOR YOU, King Training Resources Oracle and Java are an uncommonly good pairing; Oracle provides relational database for most environments and Java provides code that works

More information

Spring,2015. Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE

Spring,2015. Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE Spring,2015 Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE Contents: Briefly About Big Data Management What is hive? Hive Architecture Working

More information

Real SQL Programming. Persistent Stored Modules (PSM) PL/SQL Embedded SQL

Real SQL Programming. Persistent Stored Modules (PSM) PL/SQL Embedded SQL Real SQL Programming Persistent Stored Modules (PSM) PL/SQL Embedded SQL 1 SQL in Real Programs We have seen only how SQL is used at the generic query interface --- an environment where we sit at a terminal

More information

An Introduction to SQL Injection Attacks for Oracle Developers. January 2004 INTEGRIGY. Mission Critical Applications Mission Critical Security

An Introduction to SQL Injection Attacks for Oracle Developers. January 2004 INTEGRIGY. Mission Critical Applications Mission Critical Security An Introduction to SQL Injection Attacks for Oracle Developers January 2004 INTEGRIGY Mission Critical Applications Mission Critical Security An Introduction to SQL Injection Attacks for Oracle Developers

More information

SQL and programming languages

SQL and programming languages SQL and programming languages SET08104 Database Systems Copyright Napier University Slide 1/14 Pure SQL Pure SQL: Queries typed at an SQL prompt. SQL is a non-procedural language. SQL specifies WHAT, not

More information

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to: D61830GC30 for Developers Summary Duration Vendor Audience 5 Days Oracle Database Administrators, Developers, Web Administrators Level Technology Professional Oracle 5.6 Delivery Method Instructor-led

More information

Introduction to Triggers using SQL

Introduction to Triggers using SQL Introduction to Triggers using SQL Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk November 24, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

Part IV: Java Database Programming

Part IV: Java Database Programming Part IV: Java Database Programming This part of the book discusses how to use Java to develop database projects. You will learn JDBC interfaces and classes, create and process SQL statements, obtaining

More information

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,... 7 Web Databases Access to Web Databases: Servlets, Applets Java Server Pages PHP, PEAR Languages: Java, PHP, Python,... Prof. Dr. Dietmar Seipel 837 7.1 Access to Web Databases by Servlets Java Servlets

More information

12 Embedding SQL in Programming languages

12 Embedding SQL in Programming languages 12 Embedding SQL in Programming languages 12.1 Introduction: using SQL from programs 12.2 Embedded SQL 12.2.1 Static and dynamic embedding 12.2.2 12.2. 3. / C 12.2. 4 Positioned Update 12.3 Transactions

More information

Accesssing External Databases From ILE RPG (with help from Java)

Accesssing External Databases From ILE RPG (with help from Java) Accesssing External Databases From ILE RPG (with help from Java) Presented by Scott Klement http://www.scottklement.com 2008-2015, Scott Klement There are 10 types of people in the world. Those who understand

More information

Performance Tuning for the JDBC TM API

Performance Tuning for the JDBC TM API Performance Tuning for the JDBC TM API What Works, What Doesn't, and Why. Mark Chamness Sr. Java Engineer Cacheware Beginning Overall Presentation Goal Illustrate techniques for optimizing JDBC API-based

More information

Supplement IV.C: Tutorial for Oracle. For Introduction to Java Programming By Y. Daniel Liang

Supplement IV.C: Tutorial for Oracle. For Introduction to Java Programming By Y. Daniel Liang Supplement IV.C: Tutorial for Oracle For Introduction to Java Programming By Y. Daniel Liang This supplement covers the following topics: Connecting and Using Oracle Creating User Accounts Accessing Oracle

More information

Using Temporary Tables to Improve Performance for SQL Data Services

Using Temporary Tables to Improve Performance for SQL Data Services Using Temporary Tables to Improve Performance for SQL Data Services 2014- Informatica Corporation. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying,

More information

12 Embedding SQL in Programming languages

12 Embedding SQL in Programming languages 12 Embedding SQL in Programming languages 12.1 Introduction: using SQL from programs 12.2 Embedded SQL 12.2.1 Static and dynamic embedding 12.2.2 Cursors 12.2. 3. ESQL / C 12.2. 4 Positioned Update 12.3

More information

Statement Level Interface. Call Level Interface. Static SQL. Status. Connections. Transactions. To connect to an SQL database, use a connect statement

Statement Level Interface. Call Level Interface. Static SQL. Status. Connections. Transactions. To connect to an SQL database, use a connect statement Interactive vs. Non-Interactive SQL Using SQL in an Application Chapter 8 Interactive SQL: SQL statements input from terminal; DBMS outputs to screen Inadequate for most uses It may be necessary to process

More information

Database System Security. Paul J. Wagner UMSSIA 2008

Database System Security. Paul J. Wagner UMSSIA 2008 Database System Security Paul J. Wagner UMSSIA 2008 Need for Database System Security Education The value is in the data 3M Poster Attacks have changed from glory-seeking to attempted financial gain Security

More information

CHAPTER 3. Relational Database Management System: Oracle. 3.1 COMPANY Database

CHAPTER 3. Relational Database Management System: Oracle. 3.1 COMPANY Database 45 CHAPTER 3 Relational Database Management System: Oracle This chapter introduces the student to the basic utilities used to interact with Oracle DBMS. The chapter also introduces the student to programming

More information

ODBC Client Driver Help. 2015 Kepware, Inc.

ODBC Client Driver Help. 2015 Kepware, Inc. 2015 Kepware, Inc. 2 Table of Contents Table of Contents 2 4 Overview 4 External Dependencies 4 Driver Setup 5 Data Source Settings 5 Data Source Setup 6 Data Source Access Methods 13 Fixed Table 14 Table

More information

Chapter 9, More SQL: Assertions, Views, and Programming Techniques

Chapter 9, More SQL: Assertions, Views, and Programming Techniques Chapter 9, More SQL: Assertions, Views, and Programming Techniques 9.2 Embedded SQL SQL statements can be embedded in a general purpose programming language, such as C, C++, COBOL,... 9.2.1 Retrieving

More information

Evaluation. Copy. Evaluation Copy. Chapter 7: Using JDBC with Spring. 1) A Simpler Approach... 7-2. 2) The JdbcTemplate. Class...

Evaluation. Copy. Evaluation Copy. Chapter 7: Using JDBC with Spring. 1) A Simpler Approach... 7-2. 2) The JdbcTemplate. Class... Chapter 7: Using JDBC with Spring 1) A Simpler Approach... 7-2 2) The JdbcTemplate Class... 7-3 3) Exception Translation... 7-7 4) Updating with the JdbcTemplate... 7-9 5) Queries Using the JdbcTemplate...

More information

Database Connectivity Toolkit for Big Data. User Manual

Database Connectivity Toolkit for Big Data. User Manual Database Connectivity Toolkit for Big Data User Manual Ovak Technologies 2015 Contents 1. Introduction... 3 1.1. Definitions and Acronyms... 3 1.2. Purpose... 3 1.3. Overview... 3 2. Open Database Connectivity

More information

The release notes provide details of enhancements and features in Cloudera ODBC Driver for Impala 2.5.30, as well as the version history.

The release notes provide details of enhancements and features in Cloudera ODBC Driver for Impala 2.5.30, as well as the version history. Cloudera ODBC Driver for Impala 2.5.30 The release notes provide details of enhancements and features in Cloudera ODBC Driver for Impala 2.5.30, as well as the version history. The following are highlights

More information

Tuning Derby. Version 10.5. Derby Document build: August 10, 2009, 1:04:58 PM (PDT)

Tuning Derby. Version 10.5. Derby Document build: August 10, 2009, 1:04:58 PM (PDT) Version 10.5 Derby Document build: August 10, 2009, 1:04:58 PM (PDT) Version 10.5 Tuning Derby Contents Copyright...4 License... 5 About this guide...9 Purpose of this guide...9 Audience... 9 How this

More information

Advanced Object Oriented Database access using PDO. Marcus Börger

Advanced Object Oriented Database access using PDO. Marcus Börger Advanced Object Oriented Database access using PDO Marcus Börger ApacheCon EU 2005 Marcus Börger Advanced Object Oriented Database access using PDO 2 Intro PHP and Databases PHP 5 and PDO Marcus Börger

More information

IT2305 Database Systems I (Compulsory)

IT2305 Database Systems I (Compulsory) Database Systems I (Compulsory) INTRODUCTION This is one of the 4 modules designed for Semester 2 of Bachelor of Information Technology Degree program. CREDITS: 04 LEARNING OUTCOMES On completion of this

More information

Developing SQL and PL/SQL with JDeveloper

Developing SQL and PL/SQL with JDeveloper Seite 1 von 23 Developing SQL and PL/SQL with JDeveloper Oracle JDeveloper 10g Preview Technologies used: SQL, PL/SQL An Oracle JDeveloper Tutorial September 2003 Content This tutorial walks through the

More information

Firebird. Embedded SQL Guide for RM/Cobol

Firebird. Embedded SQL Guide for RM/Cobol Firebird Embedded SQL Guide for RM/Cobol Embedded SQL Guide for RM/Cobol 3 Table of Contents 1. Program Structure...6 1.1. General...6 1.2. Reading this Guide...6 1.3. Definition of Terms...6 1.4. Declaring

More information

Relational databases and SQL

Relational databases and SQL Relational databases and SQL Matthew J. Graham CACR Methods of Computational Science Caltech, 29 January 2009 relational model Proposed by E. F. Codd in 1969 An attribute is an ordered pair of attribute

More information

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases. SQL Databases Course by Applied Technology Research Center. 23 September 2015 This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases. Oracle Topics This Oracle Database: SQL

More information

Database programming made easier Master thesis of Roland Balk

Database programming made easier Master thesis of Roland Balk Database programming made easier Master thesis of Roland Balk rolandbalk@upcmail.nl, 4-1-2016 University of Twente, Formal Methods & Tools group Supervised by: L. Wevers Msc, prof. dr. M. Huisman and dr.

More information

Connect to MySQL or Microsoft SQL Server using R

Connect to MySQL or Microsoft SQL Server using R Connect to MySQL or Microsoft SQL Server using R 1 Introduction Connecting to a MySQL database or Microsoft SQL Server from the R environment can be extremely useful. It allows a research direct access

More information

FileMaker 13. ODBC and JDBC Guide

FileMaker 13. ODBC and JDBC Guide FileMaker 13 ODBC and JDBC Guide 2004 2013 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc.

More information

ASP.NET Programming with C# and SQL Server

ASP.NET Programming with C# and SQL Server ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET Objectives In this chapter, you will: Connect to SQL Server from ASP.NET Learn how to handle

More information

N3612: Desiderata of a C++11 Database Interface

N3612: Desiderata of a C++11 Database Interface N3612: Desiderata of a C++11 Database Interface Thomas Neumann Technische Univeristät München neumann@in.tum.de 2013-03-15 With the recent papers N3415 and N3458 two proposals have been made for a standard

More information

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

ANDROID APPS DEVELOPMENT FOR MOBILE GAME ANDROID APPS DEVELOPMENT FOR MOBILE GAME Lecture 7: Data Storage and Web Services Overview Android provides several options for you to save persistent application data. Storage Option Shared Preferences

More information

Using the SQL Server Linked Server Capability

Using the SQL Server Linked Server Capability Using the SQL Server Linked Server Capability SQL Server s Linked Server feature enables fast and easy integration of SQL Server data and non SQL Server data, directly in the SQL Server engine itself.

More information

Customer Bank Account Management System Technical Specification Document

Customer Bank Account Management System Technical Specification Document Customer Bank Account Management System Technical Specification Document Technical Specification Document Page 1 of 15 Table of Contents Contents 1 Introduction 3 2 Design Overview 4 3 Topology Diagram.6

More information

Database Extension 1.5 ez Publish Extension Manual

Database Extension 1.5 ez Publish Extension Manual Database Extension 1.5 ez Publish Extension Manual 1999 2012 ez Systems AS Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License,Version

More information