Connecting to a Database through Programs Database Systems.

Slides:



Advertisements
Similar presentations
XML Configuration in Java David Roossien CS62112/2009.
Advertisements

Database System Concepts and Architecture
Lecture plan Information retrieval (from week 11)
Chapter 13 © 2000 Prentice Hall Chapter 13 Accessing the Database Server: ODBC, OLE DB, and ADO David M. Kroenke Database Processing © 2000 Prentice Hall.
Data Modeling and Database Design Chapter 1: Database Systems: Architecture and Components.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
Fundamentals, Design, and Implementation, 9/e Chapter 12 ODBC, OLE DB, ADO, and ASP.
Prentice Hall © COS 346 Day Agenda Capstone Progress report due Assignment 9 not corrected yet Assignment 10 posted (last one!!!) –Due.
Fundamentals, Design, and Implementation, 9/e COS 346 DAY 22.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 12-1 COS 346 Day 22.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
JDBC. In This Class We Will Cover: What SQL is What ODBC is What JDBC is JDBC basics Introduction to advanced JDBC topics.
Database Processing Applications Chapter Seven DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 4 th Edition.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 12-1 David M. Kroenke’s Chapter Twelve: ODBC Database Processing: Fundamentals,
Overview of Database Access in.Net Josh Bowen CIS 764-FS2008.
ODBC Open DataBase Connectivity a standard database access method developed by Microsoft to access data from any application regardless of which database.
Database Applications.  Database Programming  Web databases  Application architecture.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
1 Section 6 Embedded SQL. 6-2 CA306 Embedded SQL Section Content 6.1Embedded SQL 6.2Java Database Connectivity 6.3Web Databases.
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
1 ODBC, OLE DB, ADO, and ASP. 2 Introduction  Because database applications today reside in a complicated environment, various standards have been developed.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Announcements Read JDBC Project Step 5, due Monday.
DB Libraries: An Alternative to DBMS By Matt Stegman November 22, 2005.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
File Processing Concepts – Field – combination of 1 or more characters that is the smallest unit of data to be accessed – Record – group of related fields.
Universal Data Access and OLE DB. Customer Requirements for Data Access Technologies High-Performance access to data Reliability Vendor Commitment Broad.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
CSS/417 Introduction to Database Management Systems Workshop 4.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
Fundamentals, Design, and Implementation, 9/e by David M. Kroenke BSA206 Database Management Systems Lecture 21: Databases and the Web Chapters 12, 13.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 12-1 David M. Kroenke’s Chapter Twelve: ODBC, OLE DB, ADO, and ASP Part.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Copyright © Curt Hill Connectivity Communicating with the Database.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Database Connectivity and Server-Side Scripting Chapter 12.
ADO.NET Architecture MIS3502: Application Integration and Evaluation David Schuff Adapted from material by Arnold Kurtz, David.
Basics of JDBC Session 14.
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
Module 4 Introduction ADO.NET.
JDBC Chapter 1 JDBC Introduction
Introduction Because database applications today reside in a complicated environment, various standards have been developed for accessing database servers.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
Database Processing Applications Chapter Seven DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 7 th Edition.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
R EMAINING TOPICS IN JDBC Sagun Dhakhwa. O VERVIEW Introduction to JDBC API Types of JDBC Drivers Introduction to ODBC.
ISC321 Database Systems I Chapter 2: Overview of Database Languages and Architectures Fall 2015 Dr. Abdullah Almutairi.
Introduction to ADO.NET
Accessing the Database Server: ODBC, OLE DB, and ADO
Introduction to Database Processing with ADO.NET
ODBC, OCCI and JDBC overview
Database Processing Applications
Java Database Connectivity
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Chapter 10 ADO.
Database Processing: David M. Kroenke’s Chapter Twelve: Part One
Presentation transcript:

Connecting to a Database through Programs Database Systems

DB Connections Typically only DBA talk directly to a database End users generally connect to a database through some type of program –Program code –Forms

Connection Part 1 Database tables are not part of a program –So you have to establish a connection to them Connections are categorized in 2 categories –READ –Insert, Update and Delete

Not all DBs are Alike Not all databases act the same way, you have to know which way your database acts This determines the facilities needed for your connection Then you have to remember that relational database systems speak SQL

Connection Introduction Because database applications today reside in a complicated environment, various standards have been developed for accessing database servers. Some of the important standards are –OBDC (Open Database Connectivity) is the early standard for relational databases. –OLE DB is Microsofts object-oriented interface for relational and other databases. –ADO.NET (Active Data Objects) is Microsofts standard providing easier access to OLE DB data for the non-object- oriented programmer.

The Role of the ODBC Standard

Open Database Connectivity (OBDC) The Open Database Connectivity (ODBC) standard provides a DBMS-independent means for processing relational database data. It was developed in the early 1990s by an industry committee and has been implemented by Microsoft and many other vendors. The goal is to allow a developer to create a single application that can access databases supported by different DBMS products without needing to be changed or recompiled.

ODBC Architecture

OBDC Components (Continued) OBDC consists of a data source, an application program, a driver manager, and a DBMS driver. A data source is the database and its associated DBMS, operating system, and network platform. –An ODBC data source can be a relational database, a file server, or a spreadsheet. An applications program issues requests to create a connection with a data source.

OBDC Components A driver manager determines the type of DBMS for a given ODBC data source and loads that driver in memory. A DBMS driver processes ODBC requests and submits specific SQL statements to a given type of data source.

Conformance Levels Levels of conformance balance the scope of the OBDC standard. There are two types of conformance levels: –ODBC conformance levels concern the features and functions that are made available through the drivers application program interface (API). A driver API is a set of functions that the application can call to receive services. –SQL conformance levels specify which SQL statements, expressions, and data types a driver can process.

Summary of OBDC Conformance Levels

Summary of SQL Conformance Levels So, why do conformance levels matter? You pick the ODBC driver you use based on your needs

How do you connect? Depends on the database and the programming environment Access can establish a DNS so that Access may be used as a front end to a database (ie front end to an oracle db) Java establishes a ODBC connection via the JDBC library C#, VB.Net use a Microsoft provided Managed Provider, ADO.Net or OBDC

The Steps whatever the case Establish a connection Open the connection Select data using an Object with SQL statement Retrieve the Data –Data is not used directly from the database –Retrieved into hold place such as a variable or object –Display the data OR Issue a Insert, Update or Delete command –Send data to the database –Usually number of rows affected is returned

Example Sample Code – bles/labjava/Customers.javahttp://science.kennesaw.edu/~mcmurray/dbTa bles/labjava/Customers.java JDBC walkthrough – ndex.htmlhttp:// ndex.html

Where does the data go? Insert, Update, Delete –Pushing data out to the Database –What is returned is the number of rows affected What happens when you read [select] data? –Somehow you have to store the data in memory

Data retrieval How much data are you retrieving? –One row – its fairly trivial Use variables –Lots of Rows Considerations to make and it will depend on the technology being used

Cursor Used by Oracle PL/SQL is known as cursor –Way data is accessed row by row –Can be utilized in Java

Example To retrieve data with SQL one row at a time you need to use cursor processing. Cursor processing is done in several steps: 1.Define the rows you want to retrieve. This is called declaring the cursor. 2.Open the cursor. This activates the cursor and loads the data. Note that declaring the cursor doesn't load data, opening the cursor does. 3.Fetch the data into variables. 4.Close the cursor.

Cursor References 9i/oracle-cursors.htmlhttp:// 9i/oracle-cursors.html ntation/berkeley- db/je/GettingStartedGuide/Cursors.htmlhttp:// ntation/berkeley- db/je/GettingStartedGuide/Cursors.html

.NET Microsofts.NET uses –Datareader Processing row by row –Datasets Declared space in memory (data structure that looks like a table) Defined using XML schema Loads all results of select statements into memory for processing /adoplus/GetDataFromDB.aspx

Labs ACCESS connecting to Oracle – _2003_Front_End_for_an_Oracle_10g_Express_Editi on_Databasehttp://aspalliance.com/893_Creating_an_MS_Access _2003_Front_End_for_an_Oracle_10g_Express_Editi on_Database ADO.Net using Visual Studio (for IS and ISA majors) –Need an Oracle Managed Provider One is includes with Visual Studio but many problems reported so need to get one from Oracle Oracle 11g is has managed provided for ADO.Net built in JDBC for CS majors

SOME JAVA Examples s/jdbc.htmlhttp://java.sun.com/developer/codesample s/jdbc.html orial/JDBC/jdbc1.htmlhttp:// orial/JDBC/jdbc1.html c/getstart/GettingStartedTOC.fm.htmlhttp://java.sun.com/j2se/1.3/docs/guide/jdb c/getstart/GettingStartedTOC.fm.html bc/index.htmlhttp:// bc/index.html

Some MySQL PHP Resources Connecting to a MySQL database via PHP – using-php.phphttp:// using-php.php – resources/articles/ddws/21.htmlhttp://dev.mysql.com/tech- resources/articles/ddws/21.html Resources for graphical support of forms development PHP – MySQL with JDBC – 81http:// 81