Ghislain Fourny. Information Systems for Engineers 7. The ecosystem around SQL
|
|
- Madlyn Woods
- 5 years ago
- Views:
Transcription
1 Ghislain Fourny Information Systems for Engineers 7. The ecosystem around SQL
2 How do we use databases?
3 How do we use databases? Simple database installed on a machine (MySQL, PostgreSQL...). User inserts and queries data on this machine.
4 User: Data analyst Queries Updates DBMS Database
5 User: Parametric users Masks Menus (parameters) DBMS Database
6 How do we use databases? Simple database installed on a machine (MySQL, PostgreSQL...). User inserts and queries data on this machine.
7 How do we use databases? Databases are installed on some servers, and interact with many more servers or clients in a broader and more complex architecture.
8 User: Database administrator DBMS Coordination Monitoring Access control Database
9 User: Database designer DBMS structure of content Database
10 User: Power user Programming (3-tier stack) DBMS Database
11 Three-tier stack Database
12 Three-tier stack Database servers Database
13 Three-tier stack Application servers Database servers Database
14 Three-tier stack Web servers Application servers Database servers Database
15 Three-tier stack Internet Web servers Application servers Database servers Database
16 Three-tier stack Clients Web servers Application servers Database servers Database
17 Three-tier stack Web servers
18 Web-Server Tier
19 Web-Server Tier
20 Web-Server Tier
21 Web-Server Tier HTTP request
22 Web-Server Tier HTTP request
23 Web-Server Tier HTTP request HTML page
24 Web-Server Tier HTTP request HTML page Images
25 Web-Server Tier HTTP request HTML page Images Additional data
26 Web-Server Tier HTTP request HTML page Images Additional data
27 Web-Server Tier HTTP request HTML page Images Additional data HTML CSS JavaScript
28 Web-Server Tier Information comes from Application Tier HTTP request HTML page Images Additional data HTML CSS JavaScript
29 Web-Server Tier Information comes from Application Tier HTTP request HTML page Images Additional data Apache Tomcat
30 Three-tier stack Web servers
31 Three-tier stack Clients Web servers Application servers Database servers Database
32 Three-tier stack Application servers
33 Application Tier Web-Server Tier
34 Application Tier Request needed information Web-Server Tier
35 Application Tier Request needed information Web-Server Tier Application Tier
36 Application Tier Request needed information Request needed data Web-Server Tier Application Tier
37 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier
38 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier
39 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier
40 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier
41 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier
42 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier Complex processing (Business logic)
43 Application Tier Request needed information Request needed data SQL Web-Server Tier Application Tier Database Tier Complex processing (Business logic)
44 Three-tier stack Application servers
45 Three-tier stack Clients Web servers Application servers Database servers Database
46 Three-tier stack Database servers Database
47 SQL environment
48 SQL environment Schema
49 SQL environment Schema Catalog
50 SQL environment Schema Catalog Cluster
51 SQL environment Schema Catalog Cluster Environment
52 Unique names MyCatalog.MySchema.MyTable
53 Unique names MyCatalog.MySchema.MyTable (default catalog)
54 Unique names MyCatalog.MySchema.MyTable (default catalog) (default schema)
55 SQL module SQL connection
56 SQL connection SQL module SQL Client
57 SQL connection SELECT a, b FROM table WHERE c = 'foo' SQL module Session SQL Client
58 SQL connection SELECT a, b FROM table WHERE c = 'foo' SQL module Session SQL Client SQL Server
59 SQL connection SELECT a, b FROM table WHERE c = 'foo' SQL module Session a b A 1 B 2 C 3 SQL Client SQL Server
60 SQL modules 1. Generic SQL interface (SQL shell) One query -> One answer. SQL module
61 SQL modules 1. Generic SQL interface (SQL shell) One query -> One answer. SQL module 2. Embedded SQL SQL invoked from a host language (C++, Java, PHP...)
62 SQL modules 1. Generic SQL interface (SQL shell) One query -> One answer. SQL module 2. Embedded SQL SQL invoked from a host language (C++, Java, PHP...) 3. True Modules Some more complex machinery, not covered here (stored functions and procedures)
63 Interfacing SQL with a Host Language ResultSet myresults = statement.executequery( "SELECT name FROM persons WHERE birthyear > 1950" ); Solution 1: Call-Level Interface (CLI)
64 Interfacing SQL with a Host Language: C void printnetworth() { } EXEC SQL BEGIN DECLARE SECTION; char studioname[50]; int presnetworth; char SQLSTATE[6]; EXEC SQL END DECLARE SECTION; EXEC SQL SELECT networth INTO :presnetworth FROM Studio, MovieExec WHERE presc = cert AND Studio.name = :studioname; Solution 2: Directly Embedded SQL
65 Interfacing SQL with a Host Language: C void printnetworth() { } EXEC SQL BEGIN DECLARE SECTION; char studioname[50]; int presnetworth; char SQLSTATE[6]; EXEC SQL END DECLARE SECTION; EXEC SQL SELECT networth INTO :presnetworth FROM Studio, MovieExec WHERE presc = cert AND Studio.name = :studioname; Solution 2: Directly Embedded SQL
66 Interfacing SQL with a Host Language: SQLJ #sql [ctx] { SELECT MAX(SALARY), AVG(SALARY) INTO :maxsalary, :avgsalary FROM employees }; Solution 2: Directly Embedded SQL
67 Interfacing SQL with a Host Language: SQLJ #sql private static iterator CaptainIterator(String, String, BigDecimal);... CaptainIterator iter; #sql [ctx] iter = { SELECT NAME, SHIP, MAXWARP FROM captains WHERE WARP BETWEEN :min AND :max }; do { #sql { FETCH :iter INTO :name, :ship, :warp}; // Print row... } while (!iter.endfetch()); iter.close(); Solution 2: Directly Embedded SQL
68 Impedance Mismatch Values Tables Rows Columns Attributes Projection Selection Join Sort Grouping
69 Impedance Mismatch Values Tables Rows Columns Attributes Projection Selection Join Sort Grouping vs. Strings Integers Pointers Objects Arrays Assignments Loops Branches
70 SQL/CLI Prepare a Statement
71 SQL/CLI Prepare a Statement Bind some parameters
72 SQL/CLI Prepare a Statement Bind some parameters Execute the statement
73 SQL/CLI Prepare a Statement Bind some parameters Execute the statement Process results
74 Java Database Connectivity
75 The paperwork import java.sql.*; class SomeClass { public static void main (String args[]) { Class.forName("org.postgresql.Driver"); } }
76 The paperwork import java.sql.*; class SomeClass { public static void main (String args[]) { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://server.example.com/test"; Properties properties = new Properties(); properties.setproperty("user","ise"); properties.setproperty("password","secret"); Connection connection = DriverManager.getConnection(url, props); } }
77 The paperwork import java.sql.*; class SomeClass { public static void main (String args[]) { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://server.example.com/test" + "?user=ise&password=secret"; Connection conn = DriverManager.getConnection(url); } }
78 Statements Connection createstatement() Statement SELECT * FROM table executequery(...) ResultSet
79 Statements Connection Connection createstatement() SELECT * FROM table preparestatement(...) Statement PreparedStatement SELECT * FROM table executequery(...) executequery() ResultSet ResultSet
80 preparestatement solution PreparedStatement statement = connection.preparestatement();
81 preparestatement solution Statement statement = connection.preparestatement(); ResultSet results = statement.executequery( "SELECT persons FROM table WHERE age > 65" );
82 createstatement solution PreparedStatement statement = connection.createstatement( "SELECT persons FROM table WHERE age > 65" );
83 createstatement solution PreparedStatement statement = connection.createstatement( "SELECT persons FROM table WHERE age > 65" ); ResultSet results = statement.executequery();
84 createstatement solution PreparedStatement statement = connection.createstatement( "SELECT persons FROM table WHERE age > 65" ); ResultSet results = statement.executequery();... ResultSet results = statement.executequery();
85 Processing the results ResultSet name year ID Einstein Gödel Turing
86 Processing the results ResultSet name year ID Einstein Gödel Turing results.next()
87 Processing the results ResultSet name year ID Einstein Gödel Turing
88 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1)
89 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Einstein
90 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Einstein int year = result.getint(2)
91 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Einstein int year = result.getint(2) 1909
92 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Einstein int year = result.getint(2) 1909 int ID = result.getint(3) 1
93 Processing the results ResultSet name year ID Einstein Gödel Turing results.next()
94 Processing the results ResultSet name year ID Einstein Gödel Turing
95 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1)
96 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Gödel
97 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Gödel int year = result.getint(2) 1931
98 Processing the results ResultSet name year ID Einstein Gödel Turing String name = result.getstring(1) Gödel int year = result.getint(2) 1931 int ID = result.getint(3) 2
99 Processing the results ResultSet name year ID Einstein Gödel Turing while(results.next()) {... results.getstring(1) results.getint(2) results.getint(3)... }
100 Updating queries Statement statement = connection.preparestatement(); ResultSet results = statement.executeupdate( "INSERT INTO table (a, b) VALUES (1, 'foo')" );
101 Updating queries PreparedStatement statement = connection.createstatement( "DELETE * FROM table" ); ResultSet results = statement.executeupdate();
102 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" );
103 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" ); statement.setint(65);
104 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" ); statement.setint(65);
105 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" ); statement.setint(65); statement.executeupdate();
106 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" ); statement.setint(65); statement.executeupdate(); statement.setint(150);
107 Passing parameters PreparedStatement statement = connection.createstatement( "DELETE * FROM table WHERE age =?" ); statement.setint(65); statement.executeupdate(); statement.setint(150); statement.executeupdate();
108 PHP <?php $connection = pg_connect("host=localhost dbname=starfleet user=kirk password=foo") or die('could not connect: '. pg_last_error()); $query = 'SELECT name, ship FROM captains'; $result = pg_query($query) or die('query failed: '. pg_last_error()); echo "<table>"; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { echo "<tr>"; foreach ($line as $col_value) { echo "<td>$col_value</td>"; } echo "</tr>"; } echo "</table>"; pg_free_result($result); pg_close($dbconn);?>
109 PHP <?php $connection = pg_connect("host=localhost dbname=starfleet user=kirk password=foo") or die('could not connect: '. pg_last_error()); $query = 'SELECT name, ship FROM captains'; $result = pg_query($query) or die('query failed: '. pg_last_error()); echo "<table>"; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { echo "<tr>"; foreach ($line as $col_value) { echo "<td>$col_value</td>"; } echo "</tr>"; } echo "</table>"; pg_free_result($result); pg_close($dbconn);?>
110 PHP <?php $connection = pg_connect("host=localhost dbname=starfleet user=kirk password=foo") or die('could not connect: '. pg_last_error()); $query = 'SELECT name, ship FROM captains'; $result = pg_query($query) or die('query failed: '. pg_last_error()); echo "<table>"; while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) { echo "<tr>"; foreach ($line as $col_value) { echo "<td>$col_value</td>"; } echo "</tr>"; } echo "</table>"; pg_free_result($result); pg_close($dbconn);?>
111 Python (SQLAlchemy) SELECT users.*, adr_count.address_count FROM users LEFT OUTER JOIN (SELECT user_id, count(*) AS address_count FROM addresses GROUP BY user_id) AS adr_count ON users.id=adr_count.user_id stmt = session.query(address.user_id, func.count('*').label('address_count')). group_by(address.user_id).subquery() for u, count in session.query(user, stmt.c.address_count). outerjoin(stmt, User.id==stmt.c.user_id).order_by(User.id): print(u, count)
112 Python (CLI-like with text()) stmt = text("select name, id FROM users where name=:name") stmt = stmt.columns(user.name, User.id) session.query(user.id, User.name). from_statement(stmt).params(name='ed').all()
113 Transactions and concurrency control
114 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,000
115 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,000
116 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,000
117 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,
118 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,
119 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3,
120 Transactions name balance Albert 1,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2,
121 Transactions name balance Albert 2,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2,
122 Transactions name balance Albert 2,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,
123 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,
124 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,
125 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
126 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
127 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
128 Transactions name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
129 Transactions: Read-Write conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
130 Transactions: Read-Write conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
131 Transactions: Write-Write conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
132 Transactions: Write-Write conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
133 Transactions: Write-Read conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
134 Transactions: Write-Read conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
135 Transactions: Write-Read conflict name balance Albert 3,000 Alan 2,000 Kurt 3, UPDATE statement SET balance = 2, UPDATE statement SET balance = 3,
136 Transactions: Write-Read conflict UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
137 Transactions: Write-Read conflict Schedule R Alice (AE), R Bob (AE), W Alice (AE), W Bob (AE), R Alice (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
138 Transactions: Write-Read conflict Conflict-equivalent Schedule R Bob (AE), R Alice (AE), W Alice (AE), W Bob (AE), R Alice (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
139 Precedence graph Cycle!
140 Transactions: Write-Read conflict Schedule R Alice (AE), W Alice (AE), R Bob (AE), R Alice (AE), W Bob (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
141 Precedence graph No Cycle!
142 Transactions: Write-Read conflict Schedule R Alice (AE), W Alice (AE), R Bob (AE), R Alice (AE), W Bob (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
143 Transactions: Write-Read conflict Conflict-equivalent, serial Schedule R Alice (AE), W Alice (AE), R Alice (AE), R Bob (AE), W Bob (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
144 Transactions: Write-Read conflict Serializable Schedule R Alice (AE), W Alice (AE), R Bob (AE), R Alice (AE), W Bob (AE), R Bob (AE) UPDATE statement SET balance = 2,000 UPDATE statement SET balance = 3,000
145 ACID properties Property Atomicity Explanation A transaction gets fully executed or not at all
146 ACID properties Property Atomicity Consistency Explanation A transaction gets fully executed or not at all Database is consistent at all times
147 ACID properties Property Atomicity Consistency Isolation Explanation A transaction gets fully executed or not at all Database is consistent at all times "As if" transactions were executed serially
148 ACID properties Property Explanation Atomicity A transaction gets fully executed or not at all Consistency Database is consistent at all times Isolation "As if" transactions were executed serially Durability A change will not be lost (power outage,...)
Embedded SQL. csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014
Embedded SQL csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs are colleagues
More informationEMBEDDED SQL. SE 3DB3 Fall 2016 MICHAEL LIUT DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY
EMBEDDED SQL MICHAEL LIUT (LIUTM@MCMASTER.CA) DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY SE 3DB3 Fall 2016 (Slides adapted from Dr. Fei Chiang, Diane Horton, examples from J. Ullman, J. Widom)
More informationEmbedded SQL. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018
Embedded SQL csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Chapter 10 Outline Database Programming: Techniques and Issues Embedded SQL, Dynamic SQL, and SQLJ Database Programming with Function Calls: SQL/CLI and JDBC Database Stored Procedures and SQL/PSM Comparing
More informationChapter 9 SQL in a server environment
Chapter 9 SQL in a server environment SQL in a Programming Environment embedded SQL persistent stored modules Database-Connection Libraries Call-level interface (CLI) JDBC PHP SQL in Real Programs We have
More informationChapter 13 Introduction to SQL Programming Techniques
Chapter 13 Introduction to SQL Programming Techniques Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Outline Database Programming: Techniques and Issues Embedded
More informationJDBC, Transactions. Niklas Fors JDBC 1 / 38
JDBC, Transactions SQL in Programs Embedded SQL and Dynamic SQL JDBC Drivers, Connections, Statements, Prepared Statements Updates, Queries, Result Sets Transactions Niklas Fors (niklas.fors@cs.lth.se)
More informationRunning SQL in Java and PHP
Running SQL in Java and PHP FCDB 9.6 9.7 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 01, 2017 Introduction to JDBC JDBC = Java Database Connectivity 1. Connect to the
More informationRunning SQL in Java and PHP
Running SQL in Java and PHP FCDB 9.6 9.7 Dr. Chris Mayfield Department of Computer Science James Madison University Feb 28, 2018 Introduction to JDBC JDBC = Java Database Connectivity 1. Connect to the
More informationNon-interactive SQL. EECS Introduction to Database Management Systems
Non-interactive SQL EECS3421 - Introduction to Database Management Systems Using a Database Interactive SQL: Statements typed in from terminal; DBMS outputs to screen. Interactive SQL is inadequate in
More informationSQL in a Server Environment
SQL in a Server Environment Vaidė Narváez Computer Information Systems January 13th, 2011 The Three-Tier Architecture Application logic components Copyright c 2009 Pearson Education, Inc. Publishing as
More informationChapter 9 SQL in a server environment
Chapter 9 SQL in a server environment SQL in a Programming Environment embedded SQL persistent stored modules Database-Connection Libraries Call-level interface (CLI) JDBC PHP Database connection The third
More informationDatabase Application Development
CS 461: Database Systems Database Application Development supplementary material: Database Management Systems Sec. 6.2, 6.3 DBUtils.java, Student.java, Registrar.java, RegistrarServlet.java, PgRegistrar.sql
More informationSQL from Applications
SQL from Applications UVic C SC 370 Dr. Daniel M. German Department of Computer Science June 4, 2003 Version: 1.1.0 6 1 SQL from Applications (1.1.0) CSC 370 dmgerman@uvic.ca Overview Embedded SQL JDBC
More informationOverview. SQL from Applications. Accesing data from an application. Embedded SQL JDBC Stored Procedures. UVic C SC 370, Fall 2002
SQL from Applications UVic C SC 370, Fall 2002 Embedded SQL JDBC Stored Procedures Overview Daniel M. German Department of Computer Science University of Victoria October 15, 2002 Version: 1.00 6 1 SQL
More informationDatabase Programming Overview. COSC 304 Introduction to Database Systems. Database Programming. JDBC Interfaces. JDBC Overview
COSC 304 Introduction to Database Systems Database Programming Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Database Programming Overview Most user interaction with
More informationCOMP102: Introduction to Databases, 23
COMP102: Introduction to Databases, 23 Dr Muhammad Sulaiman Khan Department of Computer Science University of Liverpool U.K. 04 April, 2011 Programming with SQL Specific topics for today: Client/Server
More informationHow to program applications. CS 2550 / Spring 2006 Principles of Database Systems. SQL is not enough. Roadmap
How to program applications CS 2550 / Spring 2006 Principles of Database Systems 05 SQL Programming Using existing languages: Embed SQL into Host language ESQL, SQLJ Use a library of functions Design a
More informationDatabase-Connection Libraries. Java Database Connectivity PHP
Database-Connection Libraries Call-Level Interface Java Database Connectivity PHP 1 An Aside: SQL Injection SQL queries are often constructed by programs. These queries may take constants from user input.
More informationDatabase-Connection Libraries
Database-Connection Libraries CALL-LEVEL INTERFACE JAVA DATABASE CONNECTIVITY PHP PEAR/DB 1 An Aside: SQL Injection SQL queries are often constructed by programs. These queries may take constants from
More informationDatabase Programming. Week 9. *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford
Database Programming Week 9 *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 interface
More informationCOP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA
COP4540 TUTORIAL PROFESSOR: DR SHU-CHING CHEN TA: H S IN-YU HA OUTLINE Postgresql installation Introduction of JDBC Stored Procedure POSTGRES INSTALLATION (1) Extract the source file Start the configuration
More informationJava application using JDBC to connect to a database.
JDBC(JAVA DATABASE CONNECTIVITY) The Java JDBC API enables Java applications to connect to relational databases via a standard API, so your Java applications become independent (almost) of the database
More informationDatabase Application Development
CS 500: Fundamentals of Databases Database Application Development supplementary material: Database Management Systems Sec. 6.2, 6.3 DBUtils.java, Student.java, Registrar.java, RegistrarServlet.java, PgRegistrar.sql
More informationEnterprise Java Unit 1- Chapter 6 Prof. Sujata Rizal
Introduction JDBC is a Java standard that provides the interface for connecting from Java to relational databases. The JDBC standard is defined by Sun Microsystems and implemented through the standard
More informationCOMP 430 Intro. to Database Systems. SQL from application code
COMP 430 Intro. to Database Systems SQL from application code Some issues How to connect to database Where, what type, user credentials, How to send SQL commands How to get communicate data to/from DB
More informationStudent Number: Please fill out the identification section above as well as the one on the back page, and read the instructions below. Good Luck!
CSC 343H1S 2013 Test 2 Duration 50 minutes Aids allowed: none Last Name: Lecture Section: Day Student Number: First Name: Instructor: Horton Please fill out the identification section above as well as
More informationChapter 3 DB-Gateways
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 3 DB-Gateways Outline Coupling DBMS and programming languages
More informationOverview. Database Application Development. SQL in Application Code. SQL in Application Code (cont.)
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 informationDatabase Application Development
Database Application Development Chapter 6 Database Management Systems 3ed 1 Overview Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures
More informationDatabase Application Development
Database Application Development Chapter 6 Database Management Systems 3ed 1 Overview Concepts covered in this lecture: SQL in application code Embedded SQL Cursors Dynamic SQL JDBC SQLJ Stored procedures
More informationOutline. Lecture 10: Database Connectivity -JDBC. Java Persistence. Persistence via Database
Outline Lecture 10: Database Connectivity -JDBC Persistence via Database JDBC (Java Database Connectivity) JDBC API Wendy Liu CSC309F Fall 2007 1 2 Java Persistence Persistence via Database JDBC (Java
More informationDiscuss setting up JDBC connectivity. Demonstrate a JDBC program Discuss and demonstrate methods associated with JDBC connectivity
Objectives Discuss setting up JDBC connectivity. Demonstrate a JDBC program Discuss and demonstrate methods associated with JDBC connectivity Setting Up JDBC Before you can begin to utilize JDBC, you must
More informationCSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige
CSC 308 2.0 System Development with Java Database Connection Budditha Hettige Department of Statistics and Computer Science Budditha Hettige 1 From database to Java There are many brands of database: Microsoft
More informationChapter 3 DB-Gateways
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 3 DB-Gateways Outline Coupling DBMS and programming languages
More informationDatabase Applications. SQL/PSM Embedded SQL JDBC
Database Applications SQL/PSM Embedded SQL JDBC 1 Course Objectives Design Construction Applications Usage 2 Course Objectives Interfacing When the course is through, you should Know how to connect to
More informationPart I: Stored Procedures. Introduction to SQL Programming Techniques. CSC 375, Fall 2017
Introduction to SQL Programming Techniques CSC 375, Fall 2017 The Six Phases of a Project: Enthusiasm Disillusionment Panic Search for the Guilty Punishment of the Innocent Praise for non-participants
More informationDatabase Application Development
Database Application Development Linda Wu (CMPT 354 2004-2) Topics SQL in application code Embedded SQL JDBC SQLJ Stored procedures Chapter 6 CMPT 354 2004-2 2 SQL in Application Code SQL commands can
More informationOptions. Real SQL Programming 1. Stored Procedures. Embedded SQL
Real 1 Options 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
More informationAsst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa
ICS 321 Spring 2011 Constraints, Triggers, Views & Indexes Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 04/04/2011 Lipyeow Lim -- University of Hawaii
More informationWorking with Databases and Java
Working with Databases and Java Pedro Contreras Department of Computer Science Royal Holloway, University of London January 30, 2008 Outline Introduction to relational databases Introduction to Structured
More informationSchedule. Feb. 12 (T) Advising Day. No class. Reminder: Midterm is Feb. 14 (TH) Today: Feb. 7 (TH) Feb. 21 (TH) Feb. 19 (T)
Schedule Today: Feb. 7 (TH) PL/SQL, Embedded SQL, CLI, JDBC. Read Sections 8.1, 8.3-8.5. Feb. 12 (T) Advising Day. No class. Reminder: Midterm is Feb. 14 (TH) Covers material through Feb. 7 (TH) lecture
More informationWentworth Institute of Technology COMP570 Database Applications Fall 2014 Derbinsky. SQL Programming. Lecture 8. SQL Programming
Lecture 8 1 Outline Context General Approaches Typical Programming Sequence Examples 2 Database Design and Implementation Process Normalization 3 SQL via API Embedded SQL SQLJ General Approaches DB Programming
More informationorigin destination duration New York London 415 Shanghai Paris 760 Istanbul Tokyo 700 New York Paris 435 Moscow Paris 245 Lima New York 455
CS50 Beyond Databases origin destination duration New York London 415 Shanghai Paris 760 Istanbul Tokyo 700 New York Paris 435 Moscow Paris 245 Lima New York 455 SQL SQL Databases MySQL PostgreSQL SQLite...
More informationDATABASES SQL INFOTEK SOLUTIONS TEAM
DATABASES SQL INFOTEK SOLUTIONS TEAM TRAINING@INFOTEK-SOLUTIONS.COM Databases 1. Introduction in databases 2. Relational databases (SQL databases) 3. Database management system (DBMS) 4. Database design
More informationCSE 530A ACID. Washington University Fall 2013
CSE 530A ACID Washington University Fall 2013 Concurrency Enterprise-scale DBMSs are designed to host multiple databases and handle multiple concurrent connections Transactions are designed to enable Data
More informationITCS Implementation. Jing Yang 2010 Fall. Class 14: Introduction to SQL Programming Techniques (Ch13) Outline
ITCS 3160 Data Base Design and Implementation Jing Yang 2010 Fall Class 14: Introduction to SQL Programming Techniques (Ch13) Outline Database Programming: Techniques and Issues Three approaches: Embedded
More informationDatabases 2012 Embedded SQL
Databases 2012 Christian S. Jensen Computer Science, Aarhus University SQL is rarely written as ad-hoc queries using the generic SQL interface The typical scenario: client server database SQL is embedded
More informationReal SQL Programming 1
Real SQL Programming 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 and ask queries of a database Reality is almost always
More informationDatabase Applications
Database Applications Database Programming Application Architecture Objects and Relational Databases John Edgar 2 Users do not usually interact directly with a database via the DBMS The DBMS provides
More informationDatabase Access with JDBC. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark
Database Access with JDBC Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Overview Overview of JDBC technology JDBC drivers Seven basic steps in using JDBC Retrieving
More informationPHP. MIT 6.470, IAP 2010 Yafim Landa
PHP MIT 6.470, IAP 2010 Yafim Landa (landa@mit.edu) LAMP We ll use Linux, Apache, MySQL, and PHP for this course There are alternatives Windows with IIS and ASP Java with Tomcat Other database systems
More informationServer-side Web Programming
Server-side Web Programming Lecture 13: JDBC Database Programming JDBC Definition Java Database Connectivity (JDBC): set of classes that provide methods to Connect to a database through a database server
More informationPERSİSTENCE OBJECT RELATİON MAPPİNG
PERSİSTENCE Most of the applications require storing and retrieving objects in a persistent storage mechanism. This chapter introduces how to store and retrieve information in a persistent storage with
More informationDataBase Lab JAVA-DATABASE CONNECTION. Eng. Haneen El-masry
In the name of Allah Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM 4113 DataBase Lab Lab # 9 JAVA-DATABASE CONNECTION El-masry 2013 Objective In this lab, we turn
More informationCSCE 4523 Introduction to Database Management Systems Final Exam Fall I have neither given, nor received,unauthorized assistance on this exam.
CSCE 4523 Introduction to Database Management Systems Final Exam Fall 2016 I have neither given, nor received,unauthorized assistance on this exam. Signature Printed Name: Attempt all of the following
More informationDATABASE SYSTEMS. Database programming in a web environment. Database System Course, 2016
DATABASE SYSTEMS Database programming in a web environment Database System Course, 2016 AGENDA FOR TODAY Advanced Mysql More than just SELECT Creating tables MySQL optimizations: Storage engines, indexing.
More informationDatabase Application Development
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 informationSQL: Programming. Announcements (September 25) Motivation. CPS 116 Introduction to Database Systems. Pros and cons of SQL.
SQL: Programming CPS 116 Introduction to Database Systems Announcements (September 25) 2 Homework #2 due this Thursday Submit to Yi not through Jun s office door Solution available this weekend No class
More informationCyrus Shahabi Computer Science Department University of Southern California C. Shahabi
Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California shahabi@usc.edu 1 Overview JDBC Package Connecting to databases with JDBC Executing
More informationApplication Programming for Relational Databases
Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California shahabi@usc.edu 1 Overview JDBC Package Connecting to databases with JDBC Executing
More informationLecture 9&10 JDBC. Mechanism. Some Warnings. Notes. Style. Introductory Databases SSC Introduction to DataBases 1.
Lecture 9&10 JDBC Java and SQL Basics Data Manipulation How to do it patterns etc. Transactions Summary JDBC provides A mechanism for to database systems An API for: Managing this Sending s to the DB Receiving
More informationLecture 27 10/30/15. CMPSC431W: Database Management Systems. Instructor: Yu- San Lin
CMPSC431W: Database Management Systems Lecture 27 10/30/15 Instructor: Yu- San Lin yusan@psu.edu Course Website: hcp://www.cse.psu.edu/~yul189/cmpsc431w Slides based on McGraw- Hill & Dr. Wang- Chien Lee
More informationDatabase Modifications and Transactions
Database Modifications and Transactions FCDB 6.5 6.6 Dr. Chris Mayfield Department of Computer Science James Madison University Jan 31, 2018 pgadmin from home (the easy way) 1. Connect to JMU s network
More informationSTARCOUNTER. Technical Overview
STARCOUNTER Technical Overview Summary 3 Introduction 4 Scope 5 Audience 5 Prerequisite Knowledge 5 Virtual Machine Database Management System 6 Weaver 7 Shared Memory 8 Atomicity 8 Consistency 9 Isolation
More informationCSCD43: Database Systems Technology. Lecture 4
CSCD43: Database Systems Technology Lecture 4 Wael Aboulsaadat Acknowledgment: these slides are based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. Steps in Database
More informationJava Database Connectivity (JDBC) 25.1 What is JDBC?
PART 25 Java Database Connectivity (JDBC) 25.1 What is JDBC? JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming
More informationDATABASE DESIGN I - 1DL300
DATABASE DESIGN I - 1DL300 Fall 2010 An introductory course on database systems http://www.it.uu.se/edu/course/homepage/dbastekn/ht10/ Manivasakan Sabesan Uppsala Database Laboratory Department of Information
More informationERwin and JDBC. Mar. 6, 2007 Myoung Ho Kim
ERwin and JDBC Mar. 6, 2007 Myoung Ho Kim ERwin ERwin a popular commercial ER modeling tool» other tools: Dia (open source), Visio, ConceptDraw, etc. supports database schema generation 2 ERwin UI 3 Data
More informationUnit 3 - Java Data Base Connectivity
Two-Tier Database Design The two-tier is based on Client-Server architecture. The direct communication takes place between client and server. There is no mediator between client and server. Because of
More informationTransactions & Concurrency Control
CMPUT 391 Database Management Systems & Concurrency Control - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta Outline Transaction Isolation & Consistency Isolation
More informationPieter van den Hombergh. March 25, 2018
ergh Fontys Hogeschool voor Techniek en Logistiek March 25, 2018 ergh/fhtenl March 25, 2018 1/25 JDBC JDBC is a Java database connectivity technology (Java Standard Edition platform) from Oracle Corporation.
More informationL6 Application Programming. Thibault Sellam Fall 2018
L6 Application Programming Thibault Sellam Fall 2018 Topics Interfacing with applications Database APIs (DBAPIS) Cursors SQL!= Programming Language Not a general purpose programming language Tailored for
More informationDATABASE SYSTEMS. Database programming in a web environment. Database System Course,
DATABASE SYSTEMS Database programming in a web environment Database System Course, 2016-2017 AGENDA FOR TODAY The final project Advanced Mysql Database programming Recap: DB servers in the web Web programming
More informationECE 650 Systems Programming & Engineering. Spring 2018
ECE 650 Systems Programming & Engineering Spring 2018 PostgreSQL Database and C++ Interface Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Also called Postgres Open source relational
More informationYou write standard JDBC API application and plug in the appropriate JDBC driver for the database the you want to use. Java applet, app or servlets
JDBC Stands for Java Database Connectivity, is an API specification that defines the following: 1. How to interact with database/data-source from Java applets, apps, servlets 2. How to use JDBC drivers
More informationA1 (Part 2): Injection SQL Injection
A1 (Part 2): Injection SQL Injection SQL injection is prevalent SQL injection is impactful Why a password manager is a good idea! SQL injection is ironic SQL injection is funny Firewall Firewall Accounts
More informationSQL: Programming Midterm in class next Thursday (October 5)
Announcements (September 28) 2 Homework #1 graded Homework #2 due today Solution available this weekend SQL: Programming Midterm in class next Thursday (October 5) Open book, open notes Format similar
More informationMore Database Programming. CS157A Chris Pollett Nov. 2, 2005.
More Database Programming CS157A Chris Pollett Nov. 2, 2005. Outline JDBC SQLJ Introduction Last day we went over some JDBC and SQLJ code examples from prior classes. Today, we will discuss JDBC and SQLJ
More informationJDBC Drivers Type. JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server.
JDBC Drivers Type 1 What is JDBC Driver? JDBC drivers implement the defined interfaces in the JDBC API for interacting with your database server. For example, using JDBC drivers enable you to open database
More informationAnnouncements. SQL: Part IV. Transactions. Summary of SQL features covered so far. Fine prints. SQL transactions. Reading assignments for this week
Announcements 2 SQL: Part IV CPS 216 Advanced Database Systems Reading assignments for this week A Critique of ANSI SQL Isolation Levels, by Berenson et al. in SIGMOD 1995 Weaving Relations for Cache Performance,
More informationTransactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all
Transactions - An action, or series of actions, carried out by a single user or application program, which reads or updates the contents of the database - Logical unit of work on the database - Usually
More informationJDBC Architecture. JDBC API: This provides the application-to- JDBC Manager connection.
JDBC PROGRAMMING JDBC JDBC Java DataBase Connectivity Useful for database driven applications Standard API for accessing relational databases Compatible with wide range of databases Current Version JDBC
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 20: Introduction to Transactions CSE 414 - Spring 2017 1 Announcements HW6 due on Wednesday WQ6 available for one more day WQ7 (last one!) due on Sunday CSE 414 - Spring
More informationAccessing databases in Java using JDBC
Accessing databases in Java using JDBC Introduction JDBC is an API for Java that allows working with relational databases. JDBC offers the possibility to use SQL statements for DDL and DML statements.
More informationChapter 4 Application Programs and Object-Relational Capabilities
Chapter 4 Application Programs and Object-Relational Capabilities Recent Development for Data Models 2016 Stefan Deßloch The "Big Picture" SQL99 Client DB Server Server-side Logic dynamic SQL JDBC 2.0
More informationLab # 9. Java to Database Connection
Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 9 Java to Database Connection Eng. Haneen El-Masry December, 2014 2 Objective In this lab, we turn
More informationChapter 1 An introduction to relational databases and SQL
Chapter 1 An introduction to relational databases and SQL Murach's MySQL, C1 2015, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge Identify the three main hardware components of a client/server
More informationCSE 135. Three-Tier Architecture. Applications Utilizing Databases. Browser. App. Server. Database. Server
CSE 135 Applications Utilizing Databases Three-Tier Architecture Located @ Any PC HTTP Requests Browser HTML Located @ Server 2 App Server JDBC Requests JSPs Tuples Located @ Server 1 Database Server 2
More informationExtracts from Intro to Db - Jdbc - JPA SpringData
arnaud.nauwynck@gmail.com Extracts from Intro to Db - Jdbc - JPA SpringData This document: http://arnaud-nauwynck.github.io/docs/introcodeextract-db-jdbc-jpa-springdata.pdf SOURCE Document : http://arnaud-nauwynck.github.io/docs/
More informationCOSC 304 Introduction to Database Systems. Advanced SQL. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 304 Introduction to Database Systems Advanced SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Transaction Management Overview The database system must ensure that
More informationChapter 3 DB-Gateways
Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 3 DB-Gateways Outline Coupling DBMS and programming languages
More informationIntroduction to Database Systems. Announcements CSE 444. Review: Closure, Key, Superkey. Decomposition: Schema Design using FD
Introduction to Database Systems CSE 444 Lecture #9 Jan 29 2001 Announcements Mid Term on Monday (in class) Material in lectures Textbook Chapter 1.1, Chapter 2 (except 2.1 and ODL), Chapter 3 (except
More informationRelational Algebra. Spring 2012 Instructor: Hassan Khosravi
Relational Algebra Spring 2012 Instructor: Hassan Khosravi Querying relational databases Lecture given by Dr. Widom on querying Relational Models 2.2 2.1 An Overview of Data Models 2.1.1 What is a Data
More informationDatabase Application Programs PL/SQL, Java and the Web
Database Application Programs PL/SQL, Java and the Web As well as setting up the database and running queries, it is vital to be able to build programs which manage the database although they will only
More informationB.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1
Basic Concepts :- 1. What is Data? Data is a collection of facts from which conclusion may be drawn. In computer science, data is anything in a form suitable for use with a computer. Data is often distinguished
More informationSQL STORED ROUTINES. CS121: Relational Databases Fall 2017 Lecture 9
SQL STORED ROUTINES CS121: Relational Databases Fall 2017 Lecture 9 SQL Functions 2 SQL queries can use sophisticated math operations and functions Can compute simple functions, aggregates Can compute
More informationDatabase Management Systems Paper Solution
Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of
More informationComparison with MySQL
Element and Attribute IT 3203 Introduction to Web Development Databases, and the Web April 21 Notice: This session is being recorded. Copyright 2007 by Bob Brown Databases and Programming Languages General
More informationThe Web Application Developer s. Red Hat Database. View. October 30, Webcast. Patrick Macdonald, Fernando Nasser. Red Hat Database Engineering
Red Hat Database The Web Application Developer s View Webcast October 30, 2001 Patrick Macdonald, Fernando Nasser Liam Stewart, Neil Padgett Red Hat Database Engineering Agenda Red Hat Database Web Interaction
More information