ADO ActiveX Data Object. ActiveX Data Objects (ADO) is Microsoft’s latest database object model. The goal of ADO is to allow VB developers to use a standard.

Slides:



Advertisements
Similar presentations
ADO DB in Access VBA © Walter Milner 2005 Slide: 1 ADO VBA Programming in Access.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
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.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 346 Day 25.
Fundamentals, Design, and Implementation, 9/e Chapter 12 ODBC, OLE DB, ADO, and ASP.
ActiveX Data Object ISYS 562. ADO An ActiveX control ActiveX is build upon COM, a contract that defines a standard interface by which objects communicate.
Using Visual Basic 6.0 to Create Web-Based Database Applications
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 236 Day 23.
Using Objects and Properties
Fundamentals, Design, and Implementation, 9/e COS 346 DAY 22.
JDBC Overview Autumn 2001 Lecturer: C. DeJong. Relational Databases widespread use used via SQL (Structured Query Language) freely available powerful.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 236 Day 24.
Programming the RecordSet Object
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Visual Basic Database Access BICS546. Microsoft Universal Data Access OLE DB: The OLE database protocol –Allows a program to access information in any.
Fundamentals, Design, and Implementation, 9/e Cos 346 Day 23.
CIS 451: ASP Recordsets Dr. Ralph D. Westfall May, 2002.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Client-server database systems and ODBC l Client-server architecture and components l More on reliability and security l ODBC standard.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Some Basic Database Terminology
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
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.
1 ODBC, OLE DB, ADO, and ASP. 2 Introduction  Because database applications today reside in a complicated environment, various standards have been developed.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ActiveX Data Object (ADO) in JavaScript J.L.Wang, Yen-Cheng Chen Dept. of Infomation Management Ming-Chuan University Jan
Introduction to ADO By David R. Stevenson Consulting Software Engineer ABB Automation.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Movie Manager by Patrick Wesley and Chris Grey Internet Database Project for CS 8630 – Summer 2004 Dr. Guimaraes.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 David M. Kroenke’s Chapter Thirteen: XML and ADO.NET Part Four Database.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Introduction to JDBC Michelle Lee, Ye Wu & Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
Lecture Note 10: Simple Database Techniques. Introduction –Database System –Access, SQL Server and others. –Microsoft Access - Interacting with this databases.
Visual Basic ADO Programming 56:150 Information System Design.
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.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
Fundamentals, Design, and Implementation, 9/e by David M. Kroenke BSA206 Database Management Systems Lecture 21: Databases and the Web Chapters 12, 13.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
ActiveX Data Objects (ADO) is Microsoft’s latest database object model. The goal of ADO is to allow VB developers to use a standard set of objects to refer.
ADO.NET. ADO.NET is a new, improved, and greatly expanded version of ADO that was developed for the Microsoft.NET initiative It incorporates all of the.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
Database Access Using JDBC BCIS 3680 Enterprise Programming.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
JDBC Java DataBase Connectivity. Loading the driver import java.sql.*... Class.forName("org.postgresql.Driver")‏
Introduction Because database applications today reside in a complicated environment, various standards have been developed for accessing database servers.
Source = Table rsObject.Open tablename, Connection Object, CursorType, LockType, adCmdTable Source = Stored Procedure rsObject.Open stored procedure name,
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
ASP-13-1 Recordsets Colorado Technical University IT420 Tim Peterson.
1 ADO Activex Data Objects. 2 ADO ADO allows users to access data easily from many existing databases (such as Access or Paradox) From ODBC compliant.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
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.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
 2 Data Object Library approaches ◦ DAO (Data Access Objects)  Original access strategy (up to VB6)  Closely linked to MS Access ◦ ADO (ActiveX Data.
ASP.NET Programming with C# and SQL Server First Edition
Visual Basic Database Access
ActiveX Data Objects (ADO)
INT213 Updating the Database.
JDBC & Servlet CSE 4504/6504 Lab.
Database Objects 1/12/2019 See scm-intranet.
Chapter 10 ADO.
Presentation transcript:

ADO ActiveX Data Object

ActiveX Data Objects (ADO) is Microsoft’s latest database object model. The goal of ADO is to allow VB developers to use a standard set of objects to refer to any OLE DB source. Is Microsoft ActiveX Component. Automatically installed with Microsoft IIS Server ADO is a programming interface to access data in a database ADO

ActiveX Data Objects (ADO) Performs same functions as ADO with following improvements: –Simpler command set –Faster execution (sometimes) –Uses less memory –Consumes less disk space –Supports any database to which Access can connect

Universal Data Access (UDA) It supports high performance data access to relational, nonrelational, and legacy data sources. Components –The OLE DB –The Core of the UDA architecture –Provides low level access to any data source

Microsoft UDA Architecture

ConnectionCommandRecordset Errors Error Parameters Parameter Fields Field ADO Objects ConnectionAllows control over the connection to the data source RecordsetContains the records that are the result of a query CommandExecutes database commands and queries ErrorContains information about Errors from ADO FieldRepresents a field in a data set ParameterWorks with Command to set parameters for stored procedures or parameter queries PropertyAllows you to access ADO object Properties

Before using ADO, you must establish a reference to the ADO library. Project, References, Microsoft ActiveX Data Objects 2.5 Library Establish Reference to ADO

1.Create a Connection Object. 2.Specify the connection string to connect to the database of interest. 3. Open the connection 4.Create a Recordset object. The Recordset object contains the results of the query after execution. 5.Specify the SQL text. When you open a recordset, you can either use a table, a stored procedure, or string containing a SQL statement. 6.Open the recordset. 7.Opening the recordset executes the query and returns the records to the recordset object. The records are accessible through the recordset object now. Basic Steps to executing a query using ADO

A Connection object represents a unique session with a data source. In the case of a client/server database system, it may be equivalent to an actual network connection to the server. Important Properties and Methods ConnectionString ConnectionTimeout Mode CursorLocation Provider Open and Close Connection Object

Create ADODB Connection Dim connAVB As ADODB.Connection Set connAVB = New ADODB.Connection connAVB.ConnectionString = "Provider = Microsoft.Jet.OLEDB.3.51;" & "Data Source=" & App.Path & "\AVB.mdb;Mode=readwrite“ connAVB.Open Connection Object

'Create ADODB Connection Dim connAVB As ADODB.Connection Set connAVB = New ADODB.Connection connAVB.ConnectionString = "Provider = Microsoft.Jet.OLEDB.3.51;" & "Data Source=" & App.Path & "\AVB.mdb;Mode=readwrite“ connAVB.Open ‘code connAVB.Close Set connAVB = Nothing Connection Object

Represents the entire set of records from a base table or the results of an executed command. You use Recordset objects to manipulate data from a provider. Important Properties and Methods CursorLocation CursorType LockType Mode Open, Close MoveFirst, MoveLast, MoveNext, and MovePrevious BOF, EOF Update, AddNew, Delete GetString, GetRows Recordset Object

Cursor refers to system resources needed to manage a set of data. Specifies the location of the cursor service. Constant Value Description adUseClient -Uses client-side cursors supplied by a local cursor. Use for desktop applications. adUseServer - Default. Uses data-provider or driver-supplied cursors. These cursors are sometimes very flexible and allow for additional sensitivity to changes others make to the data source. CursorLocation

Dynamic cursor — allows you to view additions, changes, and deletions by other users; allows all types of movement through the Recordset Keyset cursor — behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. Static cursor — provides a static copy of a set of records for you to use to find data or generate reports; always allows bookmarks and therefore allows all types of movement through the Recordset. Additions, changes, or deletions by other users will not be visible. This is the only type of cursor allowed when you open a client-side Recordset object. Forward-only cursor — allows you to only scroll forward through the Recordset. Additions, changes, or deletions by other users will not be visible. This improves performance in situations where you need to make only a single pass through a Recordset. Cursor Types

LockType is important when you have multiple users accessing the same data. Lock Types Lock TypeConstantResult N/AadLockUnSpecified Read OnlyadLockReadOnlyNo edits OptimisticadLockOptimisticLocked as each update submitted. BatchOptimisticadLockBatchOptimisticLocked when all updates submitted PessimisticadLockPessimisticLocked from Recordset creation

Public Sub MoveX() ' connection and recordset variables Dim rstAuthors As ADODB.Recordset Dim Cnxn As ADODB.Connection Dim strCnxn As String Dim strSQLAuthors As String ' Open connection Set Cnxn = New ADODB.Connection strCnxn = "Provider=sqloledb;Data Source=a-iresmi2000;Initial Catalog=pubs;User Id=sa;Password=;" Cnxn.Open strCnxn ' Open recordset from Authors table Set rstAuthors = New ADODB.Recordset rstAuthors.CursorLocation = adUseClient Opening a RecordSet

strSQLAuthors = "SELECT au_id, au_fname, au_lname, city, state FROM Authors ORDER BY au_lname” rstAuthors.Open strSQLAuthors, strCnxn, adOpenStatic, adLockOptimistic, adCmdText rstAuthors.MoveFirst numRecords = rstAuthors.RecordCount city = rstAuthors!city rstAuthors.Close Cnxn.Close Set rstAuthors = Nothing Set Cnxn = Nothing End Sub Opening a RecordSet

ADO.NET ADO.NET is a new, improved, and greatly expanded version of ADO that was developed for the Microsoft.NET initiative It incorporates all of the functionality of ADO and facilitates the transformation of XML documents to and from database data It uses datasets, which is an in-memory, fully- functioned, independent databases

Role of ADO.NET ADO.NET serves as an intermediary between all types of.NET applications and the DBMS and database

Data Provider A.NET data provider is a library of classes that provides ADO.NET services Microsoft’s provides three data providers –OLE DB data provider can be used to process any OLE DB-compliant data source –SQLClient data provider is purpose-built for use with SQL Server –OracleClient data provider is purpose-built for use with Oracle

Data Provider Components

A connection object is similar to the OBDC’s connection object A command object is created on an established connection A data reader provides read-only, forward-only, fast access to database data An application can get and put data to and from the database using the command object A dataset is an in-memory database that is disconnected from any regular database –It distinguishes ADO.NET from the previous data access technology

The ADO.NET Dataset A dataset is an in-memory database that is disconnected from any regular database Datasets can have –Multiple tables, views, and relationships Tables may have surrogate key (auto increment columns), primary keys, and be declared as unique –Referential integrity rules and actions –The equivalent of triggers Datasets may be constructed from several different databases and managed by different DBMS

Dataset Advantages Dataset contents and its XML schema can be easily formatted as an XML document Also, XML schema documents can be read to create the structure of the dataset, and XML documents can be read to fill the dataset Datasets are needed to provide a standardized, non- proprietary means to process database views –This is important for the processing of views with multiple multi-value paths

Dataset Disadvantages Because dataset data are disconnected from regular database, only optimistic locking can be used when updating the regular database with the dataset In the case of conflict, either the dataset must be reprocessed or the data change must be forced onto the database, causing the lost update problem Thus, datasets cannot be used for applications in which optimistic locking is problematical –Instead, the ADO.NET command object should be used

JDBC & Servlet

Outline HTML Forms Redirecting Request to other resources Tomcat Functions in JDBC & Servlet

HTML Forms An interface controls to collect data from the user and transmit it to server.

Element in Forms TEXT CONTROLS: PASSWORD FIELDS: TEXT AREAS: INPUT YOUR RESUME HERE Checkbox Radio Button

Cont. List Item 1 Item 2 Item 3 Multilist Item 1 Item 2 Item 3

Cont. Submit Button Reset Button Image Button File

Tomcat A light web server that supports servlet & JSP. It can be integrated in Apache, IIS

What is JDBC & Servlet? JDBC (Java DataBase Connectivity) provides functions to access database system. Servlet enables java for CGI programs. Setup JDBC environment:

JDBC : Establishing a Connection loading the driver DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); making the connection String url = Connection con = DriverManager.getConnection(url, “loginName", “Password");

Statement Create a statement Statement stmt = con.createStatement(); Two methods of statement 1. executeUpdate() create, alter, drop a table Or insert, delete, update data 2. executeQuery() select

Create Table String createTableCoffees = "CREATE TABLE COFFEES " + "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " + "SALES INTEGER, TOTAL INTEGER)"; stmt.executeUpdate(createTableCoffees);

Query Data from a Table stmt.executeQuery (“select * from customer”); ResultSet rs = stmt.executeQuery( "SELECT COF_NAME, PRICE FROM COFFEES");

Display Result Method next() Initially the cursor is above the first row of data. After call the method next(), the cursor is pointing to the first row of data. A Sample while (rs.next()) { String s = rs.getString ("COF_NAME"); float n = rs.getFloat ("PRICE"); System.out.println (s + " " + n); } References: