Download presentation
Presentation is loading. Please wait.
Published byWinfred Tucker Modified over 8 years ago
1
School of Computing and Management Sciences © Sheffield Hallam University Issues of Data Access 101(-ish) ways to access data from a database! ODBC One method in more detail: OLE DB and ADO In favour of Stored Procedures? A look at Java Stored Procedures
2
Server Side Client Side DriversDrivers JDBC - ODBC Bridge Forms Embe dded SQL RDBMS specific apps eg: VB Delphi etc General data aware apps eg: Specific RDBSM eg ORACLE Other ODBC compliant RDBMS SQL Databases ODBC Native JDBC Apps and applets Java JDO OLE DB Other data stores Proprietary database access protocols OO4O
3
School of Computing and Management Sciences © Sheffield Hallam University It works both ways You can access non-Oracle databases using Oracle client tools, such as Forms: –Heterogeneous Services (HS) include: Generic Connectivity (using Industry standards) Transparent Gateways (using proprietary calls) From a non-Oracle IDE you can make native calls, provided you have Oracle client binaries installed. And any mix in between….!
4
School of Computing and Management Sciences © Sheffield Hallam University Why such heterogeneousness? Departmental decision making Cheapest at the time Familiarity Organisational mergers relative “importance” of sites Personal Computing
5
School of Computing and Management Sciences © Sheffield Hallam University ODBC Recognised the need to get Front Ends talking to different Back Ends Resulted form work done by SAG and X/Open Version 1, from Microsoft, 1992 It is be database and language neutral, and amongst other things it: –Makes and manages database connections –Allocates/deallocates handles –executes ISO SQL –retrieves results –Accesses schema metadata
6
School of Computing and Management Sciences © Sheffield Hallam University ODBC It does merely expose a database’s functionality, and cant enhance it It does not allow for cross-platform functionality Version 1 and 2 suffered from a poor performance reputation. This could be more to do with the RAD environment that ODBC was often used with. –See Ken North: odbcperf.html
7
School of Computing and Management Sciences © Sheffield Hallam University Using OLE DB Real world information systems are increasingly made up from a series of different technologies. Organisations may have both Mainframes and client- server systems each with different databases and applications on them. There is often a need for the PC desktop to be the presenter of information. OLE DB responds to this scenario by setting out a specification for a set of low-level data access interfaces to work against many types of data store in a standard way. Use of an Oracle provider is preferred because it is a native OLE DB provider and gives access to Oracle-specific database features, such as support for LOBs, PL/SQL stored procedures, and REF CURSORs. Whilst Client needs to be 8i or higher, you can use OLE DB to access data from Oracle databases of version 7.3.4 or higher. Only one version of OraOLEDB can exist on a machine at a time, and, because it is COM-based, OLE DB is unable to cope with multiple Oracle homes.
8
School of Computing and Management Sciences © Sheffield Hallam University Using ADO to hide OLE DB Microsoft ActiveX® Data Objects (ADO) is a high-level object-oriented interface to OLE DB data which presents the applications programmer with a set of objects, including a database independent recordset. It is possible to call OLE DB methods directly, but the ADO encapsulation hides the low-level complexities The extra overhead of the extra layers of abstraction can be worth it if: –An application which accesses different database platforms simultaneously –An application which needs has the ability to be used with any customer-defined database back end –In an environment where (expensive) C++ programmers with low-level database experience are hard to acquire, but where Delphi or VB skills are less hard to find Another benefit of using ADO is that you can assume that the database access layer is already in place if your clients are running MS Windows. ADO and OLE DB are supplied by Microsoft and installed with Windows. No need to worry about installing extras like the Borland Database Engine (BDE) on client machines together with your application. An ADO-based application requires that ADO 2.1 be installed on the client computer.
9
School of Computing and Management Sciences © Sheffield Hallam University The ADO model NOTE: Blue indicate Delphi component names that use the ADO object
10
School of Computing and Management Sciences © Sheffield Hallam University SQL is non-procedural –designed to be relatively approachable to non- programmers PL/SQL is a procedural extension to SQL –many Oracle products are themselves written in pl/sql –but it IS proprietary What is PL/SQL?
11
School of Computing and Management Sciences © Sheffield Hallam University Standard DML commands SQL functions SQL transaction control creation and control of “cursors” flow control - IF, WHEN, LOOP…. Error Handling ×DDL What can be done with PL/SQL?
12
School of Computing and Management Sciences © Sheffield Hallam University Anonymous Block Application Procedure or Function Database Trigger Application Trigger Stored Procedure or Function Packages Where does PL/SQL live?
13
School of Computing and Management Sciences © Sheffield Hallam University Stored Procedures Major benefits are speed…. –no compilation is required at execution time. –Stored procedures are loaded once into the SGA –They remain there until they are paged out. –Subsequent executions of the stored procedure are much faster Code management… –Stored in the data dictionary. –Can be called by many users. –Improved coding productivity
14
School of Computing and Management Sciences © Sheffield Hallam University Stored Procedures cont…. And Security –eg: you can grant users access to a procedure that updates a table but not grant them access to the table itself However, DBAs need to be aware of the memory demands of stored procedures
15
School of Computing and Management Sciences © Sheffield Hallam University Packages Packages encapsulate related procedures, functions, and associated cursors and variables together as a unit in the database. Only packages can be pinned. Oracle provides a procedure dbms_shared_pool.keep to pin a package. Packages can be unpinned with dbms_shared_pool.unkeep.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.