CSE 135. Three-Tier Architecture. Applications Utilizing Databases. Browser. App. Server. Database. Server
|
|
- Melvin Jennings
- 5 years ago
- Views:
Transcription
1 CSE 135 Applications Utilizing Databases Three-Tier Architecture Any PC HTTP Requests Browser HTML Server 2 App Server JDBC Requests JSPs Tuples Server 1 Database Server 2 Students example: Create a jdbc-examples database in your db, then create this schema CREATE TABLE students ( ID SERIAL PRIMARY KEY, pid INTEGER, first_name TEXT, middle_name TEXT, last_name TEXT ); INSERT INTO students (pid, first_name, middle_name, last_name) VALUES ( , 'Mary', '', 'Doe'); INSERT INTO students (pid, first_name, middle_name, last_name) values ( , 'John', 'T', 'Smith'); 3 1
2 Accessing the students table with JDBC import java.sql.*; class JdbcTest { public static void main (String args []) throws SQLException { // Registering Postgresql JDBC driver Class.forName("org.postgresql.Driver"); // Open a connection to the database Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost/jdbc-examples?" + "user=postgres&password=postgres"); 5 JDBC (cont d) // Query the student PIDs Statement stmt = conn.createstatement(); ResultSet rset = stmt.executequery("select pid FROM students"); // Print out the PID (1st attribute) while (rset.next ()) System.out.println (rset.getint(1)); //close the result set, statement, and connection rset.close(); stmt.close(); conn.close(); 6 Updates stmt.executeupdate( UPDATE students SET first_name = John WHERE ID = 1 ); 7 2
3 PreparedStatement Object If you want to execute a Statement many times + defend against SQL injection attack use a PreparedStatement object instead: PreparedStatement pstmt = conn.preparestatement( "UPDATE students SET first_name =? " + "WHERE ID =?"); pstmt.setstring(1, John"); pstmt.setint(2, 1); 8 PreparedStatement Object (cont d) The following two code fragments accomplish the same thing: String updatestr = "UPDATE students SET first_name = John " + "WHERE ID = 1"; stmt.executeupdate(updatestr); PreparedStatement pstmt = conn.preparestatement( "UPDATE students SET first_name =? " + "WHERE ID =?"); pstmt.setstring(1, John"); pstmt.setint(2, 1); updatesales.executeupdate(): 9 ResultSet Object int getint(int columnindex) Retrieves the value of the designated column in the current row of a ResultSet object as an int Java type int getint(string columnname) String getstring(int columnindex) String getstring(string columnname) 10 3
4 Using Transactions When a connection is created, it is in AutoCommit mode, that is, each individual SQL statement is treated as a transaction and will be automatically committed right after it is executed conn.setautocommit(false); <transaction> conn.commit(); conn.setautocommit(true); You can omit if you do not wish to switch back to autocommit mode. Then this point becomes the start of a new transaction 11 Why use transactions Example Requirement: Students 2 and 3 either enroll in the class 2 together or they do not enroll in it at all conn.setautocommit(false); PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?,?) ); pstmt.setint(1, 2); pstmt.setint(2, 2); pstmt.setint(1, 3); pstmt.setint(2, 2) conn.commit(); 12 Why use transactions? Automatic Recovery protects from Crash Effects conn.setautocommit(false); PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?,?) ); pstmt.setint(1, 2); pstmt.setint(2, 2); pstmt.setint(1, 3); Crash pstmt.setint(2, 2) conn.commit(); 13 4
5 Covered and not-covered Crash Cases Covered (the typical crash): CPU halt Loss of RAM memory state Crash of database server Not Covered Loss of disk state 14 Recovery of non-committed transactions guarantees that the executed part has no effect conn.setautocommit(false); PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?,?) ); pstmt.setint(1, 2); pstmt.setint(2, 2); pstmt.setint(1, 3); Crash pstmt.setint(2, 2) conn.commit(); 15 Recovery of committed transactions guarantees that the executed part is definitely in the database conn.setautocommit(false); PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?,?) ); pstmt.setint(1, 2); pstmt.setint(2, 2); pstmt.setint(1, 3); pstmt.setint(2, 2) Crash conn.commit();
6 Why use transactions? Bugs due to Concurrent Processes Classes have enrollment limit of 100 students. See what can happen by two processes running in parallel, without using concurrency control: First process enrolls student 1 in class 2. Second process enrolls student 2 in class 2. ResultSet rset = stmt.executequery( "SELECT count(*) FROM enrollment WHERE class=2"); if (rset.next ()) { if (rset.getint(1) < 100) ResultSet rset = stmt.executequery( "SELECT count(*) FROM enrollment WHERE class=2"); if (rset.next ()) { if (rset.getint(1) < 100) { PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?, 2) ); pstmt.setint(1, 1); else // enrollment limit has been reached { PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?, 2) ); pstmt.setint(1, 2); else // enrollment limit has been reached 17 Concurrency Control guarantees that the concurrent computation is limited to computations equivalent to a serial execution of the transactions Concurrency control methods employ lock systems and/or transaction abortions and statement exceptions to avoid malicious concurrency scenarios conn.setautocommit(false); ResultSet rset = stmt.executequery( "SELECT count(*) FROM enrollment WHERE class=2"); if (rset.next ()) { if (rset.getint(1) < 100) conn.setautocommit(false); ResultSet rset = stmt.executequery( "SELECT count(*) FROM enrollment WHERE class=2"); if (rset.next ()) { if (rset.getint(1) < 100) ABORT { PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?, 2) ); pstmt.setint(1, 1); else // enrollment limit has been reached conn.commit { PreparedStatement pstmt = conn.preparestatement( INSERT INTO enrollment (student, class) VALUES (?, 2) ); pstmt.setint(1, 2); else // enrollment limit has been reached 18 Retrieving Exceptions JDBC lets you catch the exceptions generated by your DBMS try { // Code that could generate a SQLException catch (SQLException e) { // Either handle exception here // or propagate it upwards with the original cause throw new RuntimeException(e); 19 6
7 Retrieving Exceptions (cont d) Release resources even if an exception if thrown try{ catch (SQLException e) { finally { // release resources in reverse-order of creation if (rs!= null) { try { rs.close(); catch (SQLException e) { // Ignore rs = null; if (pstmt!= null) { if (conn!= null) { 20 Back to the Students Example 21 1 st Attempt: only reports students no forms 22 7
8 1 st Attempt; Split apart menus, advertisements, etc Menu HTML Code <b>data Entry Menu</b> <ul> <li><a href= students.jsp">students<a></li> <li><a href="classes.jsp">classes<a></li> <li><a href= enrollment.jsp">enrollment<a></li> </ul> 23 1 st Attempt JSP Code <html> <body><table><tr> <td><jsp:include page="menu.html /></td> <td> <Open Connection Code> <Statement Code> <Presentation Code> <Close Connection Code> </td> </tr></table></body> </html> 24 1 st Attempt Open Connection Code <%-- Import the java.sql package --%> <%@ page import="java.sql.*" %> <% <variable declarations and initializations> try { // Registering Postgresql JDBC driver Class.forName("org.postgresql.Driver"); // Open a connection to the database conn = DriverManager.getConnection( "jdbc:postgresql://localhost/jdbc-examples?" + "user=postgres&password=postgres"); %> 25 8
9 1 st Attempt Statement Code <% // Create the statement stmt = conn.createstatement(); // Use the statement to SELECT the students // FROM the students table. rs = stmt.executequery("select * FROM students"); %> 26 1 st Attempt Presentation Code <table> <tr> <th>id</th> <th>pid</th> <th>first Name</th> <th>middle Name</th> <th>last Name</th> </tr> <%-- Iterate over the ResultSet --%> <% while ( rs.next() ) { %> <Iteration Code> <% %> </table> 27 1 st Attempt Iteration Code <tr> <%-- Get the id--%> <td><%=rs.getint( ID")%></td> <%-- Get the pid --%> <td><%=rs.getint( pid")%></td> <%-- Get the first name --%> <td><%=rs.getstring("first_name")%></td> <%-- Get the middle name --%> <td><%=rs.getstring("middle_name")%></td> <%-- Get the last name --%> <td><%=rs.getstring("last_name")%></td> </tr> 28 9
10 1 st Attempt Close Connection Code <% // Close the ResultSet rs.close(); // Close the Statement statement.close(); // Close the Connection conn.close(); catch (SQLException e) { <Exception handling> %> 29 2 nd Attempt: Insertion form included 30 Model 1 programming Database accessing code If request to insert student perform SQL INSERT If request to delete student perform SQL UPDATE If request to update student perform SQL DELETE HTML-producing part of JSP INSERT STUDENT FORM UPDATE STUDENT FORMS DELETE STUDENT FORMS
11 2 nd Attempt JSP Code <html> <body><table><tr> <td><jsp:include page="menu.html /></td> <td> <Open Connection Code> <Insertion Code> <Statement Code> <Presentation Code> <Close Connection Code> </td> </tr></table></body> </html> 32 2 nd Attempt Presentation Code <table> <tr> <th>id</th> <th>pid</th> <th>first Name</th> <th>middle Name</th> <th>last Name</th> </tr> <Insert Form Code> <%-- Iterate over the ResultSet --%> <% while ( rs.next() ) { %> <Iteration Code> <% %> </table> 33 2 nd Attempt Insert Form Code <tr> <form action="students.jsp" method= POST"> <input type="hidden" name="action" value="insert"/> <th> </th> <th><input value="" name= pid" size="10"/></th> <th><input value="" name="first" size="15"/></th> <th><input value="" name="middle" size="15"/></th> <th><input value="" name="last" size="15"/></th> <th><input type="submit" value="insert"/></th> </form> </tr> 34 11
12 2 nd Attempt Insertion Code // Check if an insertion is requested String action = request.getparameter("action"); if (action!= null && action.equals("insert")) { // Create the prepared statement to INSERT student values pstmt = conn.preparestatement( "INSERT INTO students (pid, first_name, middle_name, last_name) VALUES (?,?,?,?)"); pstmt.setint(1,integer.parseint(request.getparameter( pid"))); int rowcount = 35 3 rd Attempt 36 3 rd Attempt JSP Code <html><body><table><tr> <td><jsp:include page="menu.html /></td> <td> <Open Connection Code> <Insertion Code> <Update Code> <Delete Code> <Statement Code> <Presentation Code> <Close Connection Code> </td> </tr></table></body></html> 37 12
13 3 rd Attempt Presentation Code <table> <tr> <th>id</th> <th>pid</th> <th>first Name</th> <th>middle Name</th> <th>last Name</th> </tr> <Insert Form Code> <%-- Iterate over the ResultSet --%> <% while ( rs.next() ) { %> <Iteration Code> <% %> </table> 38 3 rd Attempt Iteration Code <tr> <form action="students.jsp" method= POST"> <input type="hidden" name="action" value="update"/> <input type="hidden" name="id" value="<%=rs.getint( id")%>"/> <%-- Get the pid --%> <td><input value="<%=rs.getint( pid)%>" name= pid /></td> <td><input type="submit" value="update"></td> </form> <form action="students.jsp" method= POST"> <input type="hidden" name="action" value="delete"/> <input type="hidden" value="<%=rs.getint( id")%>" name="id"/> <td><input type="submit" value="delete"/></td> </form> </tr> 39 3 rd Attempt Delete Code // Check if a delete is requested if (action!= null && action.equals("delete")) { // Create the prepared statement to DELETE students pstmt = conn.preparestatement( "DELETE FROM Students WHERE id =?"); pstmt.setint(1, Integer.parseInt(request.getParameter("id"))); int rowcount = 40 13
14 3 rd Attempt Update Code // Check if an update is requested if (action!= null && action.equals("update")) { // Create the prepared statement to UPDATE student values pstmt = conn.preparestatement( "UPDATE students SET pid =?, first_name =? middle_name =?, last_name =? WHERE ID =?"); pstmt.setint(1, Integer.parseInt(request.getParameter("pid"))); int rowcount = 41 14
Three-Tier Architecture
Three-Tier Architecture Located @ Any PC HTTP Requests Microsoft Internet Explorer HTML Located @ Your PC Apache Tomcat App Server Java Server Pages (JSPs) JDBC Requests Tuples Located @ DBLab MS SQL Server
More informationCSE 510 Web Data Engineering
CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern UB CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern A Data Access Object (DAO) is a bean encapsulating
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 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 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 informationOracle Database 10g Java Web
Oracle Database 10g Java Web 2005 5 Oracle Database 10g Java Web... 3... 3... 4... 4... 4 JDBC... 5... 5... 5 JDBC... 6 JDBC... 8 JDBC... 9 JDBC... 10 Java... 11... 12... 12... 13 Oracle Database EJB RMI/IIOP...
More informationLogging and Recovery. 444 Section, April 23, 2009
Logging and Recovery 444 Section, April 23, 2009 Reminders Project 2 out: Due Wednesday, Nov. 4, 2009 Homework 1: Due Wednesday, Oct. 28, 2009 Outline Project 2: JDBC ACID: Recovery Undo, Redo logging
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 informationIntroduction to JDBC. JDBC: Java Database Connectivity. Why Access a Database with Java? Compilation. Six Steps. Packages to Import
Introduction to JDBC JDBC: Java Database Connectivity JDBC is used for accessing databases from Java applications Information is transferred from relations to objects and vice-versa databases optimized
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 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 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 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 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 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 informationJava Database Connectivity
Java Database Connectivity INTRODUCTION Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in Agenda Introduction
More informationJava and the Java DataBase Connectivity (JDBC) API. Todd Kaufman April 25, 2002
Java and the Java DataBase Connectivity (JDBC) API Todd Kaufman April 25, 2002 Agenda BIO Java JDBC References Q&A Speaker 4 years Java experience 4 years JDBC experience 3 years J2EE experience BS from
More informationChapter 5: Advanced SQL" Chapter 5: Advanced SQL"
Chapter 5: Advanced SQL" Database System Concepts, 6 th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Chapter 5: Advanced SQL" Accessing SQL From a Programming Language!
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 informationProgramming in Java
320341 Programming in Java Fall Semester 2014 Lecture 16: Introduction to Database Programming Instructor: Slides: Jürgen Schönwälder Bendick Mahleko Objectives This lecture introduces the following -
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 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 15 Java Server Pages (JSP)
Sungkyunkwan University Chapter 15 Java Server Pages (JSP) Prepared by J. Jung and H. Choo Web Programming Copyright 2000-2018 Networking 2000-2012 Networking Laboratory Laboratory 1/30 Server & Client
More informationServlet 5.1 JDBC 5.2 JDBC
5 Servlet Java 5.1 JDBC JDBC Java DataBase Connectivity Java API JDBC Java Oracle, PostgreSQL, MySQL Java JDBC Servlet OpenOffice.org ver. 2.0 HSQLDB HSQLDB 100% Java HSQLDB SQL 5.2 JDBC Java 1. JDBC 2.
More informationIntroduction to Databases
JAVA JDBC Introduction to Databases Assuming you drove the same number of miles per month, gas is getting pricey - maybe it is time to get a Prius. You are eating out more month to month (or the price
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 informationDesigning a Persistence Framework
Designing a Persistence Framework Working directly with code that uses JDBC is low-level data access; As application developers, one is more interested in the business problem that requires this data access.
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 informationVanillaCore Walkthrough Part 1. Introduction to Database Systems DataLab CS, NTHU
VanillaCore Walkthrough Part 1 Introduction to Database Systems DataLab CS, NTHU 1 The Architecture VanillaDB JDBC/SP Interface (at Client Side) Remote.JDBC (Client/Server) Query Interface Remote.SP (Client/Server)
More informationDB Programming. Database Systems
DB Programming Database Systems 1 Agenda MySQL data types Altering the Schema More Advanced MySQL JDBC DB Coding Tips 2 MySQL Data Types There are 3 main groups of types: Numeric Date String http://dev.mysql.com/doc/refman/5.6/en/data-types.html
More informationTopic 12: Database Programming using JDBC. Database & DBMS SQL JDBC
Topic 12: Database Programming using JDBC Database & DBMS SQL JDBC Database A database is an integrated collection of logically related records or files consolidated into a common pool that provides data
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 informationIBM DB2 9 Application Developer. Download Full Version :
IBM 000-733 DB2 9 Application Developer Download Full Version : http://killexams.com/pass4sure/exam-detail/000-733 QUESTION: 130 A solution is needed to process a large amount of inventory table data on
More informationLecture 2. Introduction to JDBC
Lecture 2 Introduction to JDBC Introducing JDBC According to Sun, JDBC is not an acronym, but is commonly misinterpreted to mean Java DataBase Connectivity JDBC: is an API that provides universal data
More informationCMPUT 391 Database Management Systems. JDBC in Review. - Lab 2 -
CMPUT 391 Database Management Systems JDBC in Review - - Department of Computing Science University of Alberta What Is JDBC? JDBC is a programming interface JDBC allows developers using java to gain access
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 informationVendor: IBM. Exam Code: Exam Name: DB2 9 Application Developer. Version: Demo
Vendor: IBM Exam Code: 000-733 Exam Name: DB2 9 Application Developer Version: Demo QUESTION 1 Which of the following applies to nickname usage? A. Nicknames cannot be created for views. B. An MQT definition
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 informationThis lecture. Databases - JDBC I. Application Programs. Database Access End Users
This lecture Databases - I The lecture starts discussion of how a Java-based application program connects to a database using. (GF Royle 2006-8, N Spadaccini 2008) Databases - I 1 / 24 (GF Royle 2006-8,
More informationSQL and Java. Database Systems Lecture 20 Natasha Alechina
Database Systems Lecture 20 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 informationEnterprise Systems. Lecture 02: JDBC. Behzad BORDBAR
Enterprise Systems Lecture 02: JDBC Behzad BORDBAR 22 Contents Running example Sample code for beginners Properties to configure Statements and ResultSet Pitfalls of using ResultSet getobject() vs. getxxx()
More informationInstructor: Jinze Liu. Fall 2008
Instructor: Jinze Liu Fall 2008 Database Project Database Architecture Database programming 2 Goal Design and implement a real application? Jinze Liu @ University of Kentucky 9/16/2008 3 Goal Design and
More informationDatabase Applications (15-415)
Database Applications (15-415) SQL-Part III & Storing Data: Disks and Files- Part I Lecture 8, February 5, 2014 Mohammad Hammoud Today Last Session: Standard Query Language (SQL)- Part II Today s Session:
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 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 informationDatabases and JDBC. by Vlad Costel Ungureanu for Learn Stuff
Databases and JDBC by Vlad Costel Ungureanu for Learn Stuff Working with Databases Create database using SQL scripts Connect to the database server using a driver Communicate with the database Execute
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 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 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 informationCSE 135. Struts with AJAX Example. Students Database Example (with AJAX)
CSE 135 Struts with AJAX Example Students Database Example (with AJAX) 2 1 Struts Example (without AJAX) Students (hyperlink) menu.jsp showstudents.do students.jsp!validate insertstudent.do Insert StudentForm
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 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 informationJava Database Connectivity
Java Database Connectivity PROGRAMMING Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in Agenda PreparedStatement
More informationIntroduction to Databases [p.3]
Object Oriented Programming and Internet Application Development Unit 5 The Back-end in Internet Software Introduction to Databases Relational Databases Designing a Relational Database Manipulating Data
More informationChapter 16: Databases
Chapter 16: Databases Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 16 discusses the following main topics: Introduction to Database
More informationContent Services for JDBC Driver User Guide
Content Services for JDBC Driver User Guide Version 5.3 SP1 August 2005 Copyright 1994-2005 EMC Corporation. All rights reserved Table of Contents Preface... 7 Chapter 1 Introducing Content Services for
More informationDelivering Rich Media Java Applications on Oracle9i Release 2. An Oracle White Paper June 2002
Delivering Rich Media Java Applications on Oracle9i Release 2 An Oracle White Paper June 2002 Delivering Rich Media Java Applications on Oracle9i Executive Overview...3 Introduction...3 What is oracle9i
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 informationEmbedded 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 informationJDBC Installation Transactions Metadata
Course Name: Advanced Java Lecture 14 Topics to be covered JDBC Installation Transactions Metadata Steps in JDBC Connectivity:Connectivity:Here are the JDBC Steps to be followed while writing JDBC
More informationSecure Programming. CS3524 Distributed Systems Lecture 16
Secure Programming CS3524 Distributed Systems Lecture 16 Secure Programming Wri=ng code that is difficult to aaack Free of dangerous bugs (from security perspec=ve) General principles Language-specific
More informationIntroduction to SQL & Database Application Development Using Java
Introduction to SQL & Database Application Development Using Java By Alan Andrea The purpose of this paper is to give an introduction to relational database design and sql with a follow up on how these
More informationChapter 4: SQL Database System Concepts 4.1 Silberschatz, Korth and Sudarshan
Chapter 4: SQL! Basic Structure! Set Operations! Aggregate Functions! Null Values! Nested Subqueries! Derived Relations! Views! Modification of the Database! Joined Relations! Data Definition Language!
More informationCSE 530A. DAOs and MVC. Washington University Fall 2012
CSE 530A DAOs and MVC Washington University Fall 2012 Model Object Example public class User { private Long id; private String username; private String password; public Long getid() { return id; public
More informationSQream Connector JDBC SQream Technologies Version 2.9.3
SQream Connector JDBC 2.9.3 SQream Technologies 2019-03-27 Version 2.9.3 Table of Contents The SQream JDBC Connector - Overview...................................................... 1 1. API Reference............................................................................
More informationDatabase in Applica.on Development. Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata
Database in Applica.on Deelopment Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata SQL from Programs SQL commands can be called from within a host language program C, C++, Jaa, Two
More informationIntroduction to SQL (III)
Introduction to SQL (III) 1 Roadmap of This Lecture Transactions Integrity Constraints SQL Data Types and Schemas Authorization Embedded SQL 2 Transactions Unit of work Atomic transaction either fully
More informationJDBC Programming: Intro
JDBC Programming: Intro Most interaction with DB is not via interactive interface Most people interact via 1. Application programs directly 2. Apps over the internet There are 3 general approaches to developing
More informationINTRODUCTION TO JDBC - Revised Spring
INTRODUCTION TO JDBC - Revised Spring 2006 - 1 What is JDBC? Java Database Connectivity (JDBC) is an Application Programmers Interface (API) that defines how a Java program can connect and exchange data
More informationCSC309: Introduction to Web Programming. Lecture 13
CSC309: Introduction to Web Programming Lecture 13 Wael Aboulsaadat University of Toronto Web-apps Architecture University of Toronto 2 N-Tier model + MQ + SP Presentation Layer HTML/CSS/JS/JSP/... Presentation
More informationCopyright 2012, Oracle and/or its affiliates. All rights reserved.
1 ADF Mobile The Data Layer 2 Mobile Device Device Services ADF Mobile Architecture Device Native Container HTML5 & JavaScript Presentation Phone Gap Native View ADF Mobile XML View ADF Controller Local
More informationaccess to a JCA connection in WebSphere Application Server
Understanding connection transitions: Avoiding multithreaded access to a JCA connection in WebSphere Application Server Anoop Ramachandra (anramach@in.ibm.com) Senior Staff Software Engineer IBM 09 May
More informationPARTIAL Final Exam Reference Packet
PARTIAL Final Exam Reference Packet (Note that some items here may be more pertinent than others; you'll need to be discerning.) Example 1 - St10CommonImportTop.jsp (with comments removed)
More informationCalling SQL from a host language (Java and Python) Kathleen Durant CS 3200
Calling SQL from a host language (Java and Python) Kathleen Durant CS 3200 1 SQL code in other programming languages SQL commands can be called from within a host language (e.g., C++ or Java) program.
More informationDatabase connectivity (II)
Lecture (07) Database connectivity (II) Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, ACU Spring 2011, Distributed Systems Agenda Connecting DB 2 Dr. Ahmed ElShafee, ACU Spring 2011, Distributed Systems The
More informationThe Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets
Course Name: Advanced Java Lecture 13 Topics to be covered The Design of JDBC The Structured Query Language Basic JDBC Programming Concepts Query Execution Scrollable and Updatable Result Sets Introducing
More information3) execute() Usage: when you cannot determine whether SQL is an update or query return true if row is returned, use getresultset() to get the
Agenda Lecture (07) Database connectivity (II) Connecting DB Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, ACU Spring 2011, Distributed Systems 2 Dr. Ahmed ElShafee, ACU Spring 2011, Distributed Systems The
More informationJDBC Guide. RDM Server 8.2
RDM Server 8.2 JDBC Guide 1 Trademarks Raima Database Manager ("RDM"), RDM Embedded, RDM Server, RDM Mobile, XML, db_query, db_revise and Velocis are trademarks of Birdstep Technology and may be registered
More informationUNIT-3 Java Database Client/Server
UNIT-3 Java Database Client/Server TOPICS TO BE COVERED 3.1 Client-Server Design: Two-Tier Database Design, Three-Tier Database Design 3.2 The JDBC API: The API Components, Database Creation, table creation
More informationDB Programming. Database Systems, Presented by Rubi Boim
DB Programming Database Systems, 2008-2009 Presented by Rubi Boim 1 Agenda Project Details Basic Oracle Usage Little More Complex Oracle stuff.. JDBC Coding Tips 2 Database project TV/Movies DB Examples:
More informationJava Database Connectivity
Java Database Connectivity ADVANCED FEATURES Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in Agenda Scrollable
More informationChapter 10 Java and SQL. Wang Yang
Chapter 10 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 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 informationINTRODUCTION TO JDBC - Revised spring
INTRODUCTION TO JDBC - Revised spring 2004 - 1 What is JDBC? Java Database Connectivity (JDBC) is a package in the Java programming language and consists of several Java classes that deal with database
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 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 informationTutorial: Using Java/JSP to Write a Web API
Tutorial: Using Java/JSP to Write a Web API Contents 1. Overview... 1 2. Download and Install the Sample Code... 2 3. Study Code From the First JSP Page (where most of the code is in the JSP Page)... 3
More informationContents. Introducing the course. Aim: to learn engineering of multi-tired web based systems. Road map of the course. Roadmap..
Contents Internet Computing Workshop Part1: Introducing the course JDBC Behzad BORDBAR Introducing the module Roadmap of the course Lab sessions Assessments Part 1: JDBC JDBC: a review Transactions 1 2
More informationTop 50 JDBC Interview Questions and Answers
Top 50 JDBC Interview Questions and Answers 1) What is the JDBC? JDBC stands for Java Database Connectivity. JDBC is a Java API that communicates with the database and execute SQLquery. 2) What is a JDBC
More informationWebSphere Connection Pooling. by Deb Erickson Shawn Lauzon Melissa Modjeski
WebSphere Connection Pooling by Deb Erickson Shawn Lauzon Melissa Modjeski Note: Before using this information and the product it supports, read the information in "Notices" on page 78. First Edition (August
More informationUnit 2 JDBC Programming
Q1. What is JDBC? Explain the types of JDBC drivers? Ans. What is JDBC? JDBC is an API, which is used in java programming for interacting with database. JDBC (Java DataBase Connection) is 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 informationUNIT III - JDBC Two Marks
UNIT III - JDBC Two Marks 1.What is JDBC? JDBC stands for Java Database Connectivity, which is a standard Java API for databaseindependent connectivity between the Java programming language and a wide
More informationJDBC 3.0. Java Database Connectivity. 1 Java
JDBC 3.0 Database Connectivity 1 Contents 1 JDBC API 2 JDBC Architecture 3 Steps to code 4 Code 5 How to configure the DSN for ODBC Driver for MS-Access 6 Driver Types 7 JDBC-ODBC Bridge 8 Disadvantages
More informationRelational Databases. CS 240 Advanced Programming Concepts
Relational Databases CS 240 Advanced Programming Concepts Database Management Systems (DBMS) Databases are implemented by software systems called Database Management Systems (DBMS) Commonly used Relational
More informationChair of Software Engineering. Java and C# in Depth. Prof. Dr. Bertrand Meyer. Exercise Session 9. Nadia Polikarpova
Chair of Software Engineering Java and C# in Depth Prof. Dr. Bertrand Meyer Exercise Session 9 Nadia Polikarpova Quiz 1: scrolling a ResultSet (JDBC) How do you assess the following code snippet that iterates
More informationCSCI/CMPE Object-Oriented Programming in Java JDBC. Dongchul Kim. Department of Computer Science University of Texas Rio Grande Valley
CSCI/CMPE 3326 Object-Oriented Programming in Java JDBC Dongchul Kim Department of Computer Science University of Texas Rio Grande Valley Introduction to Database Management Systems Storing data in traditional
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 informationPersistency Patterns. Repository and DAO
Persistency Patterns Repository and DAO 1 Repository pattern Basically, the Repository pattern just means putting a façade over your persistence system so that you can shield the rest of your application
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 information