Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Access as an ODBC Client Application A Presentation for the Microsoft Access SIG of the North Texas PC User Group and the Metroplex Access Developers.

Similar presentations


Presentation on theme: "Microsoft Access as an ODBC Client Application A Presentation for the Microsoft Access SIG of the North Texas PC User Group and the Metroplex Access Developers."— Presentation transcript:

1 Microsoft Access as an ODBC Client Application A Presentation for the Microsoft Access SIG of the North Texas PC User Group and the Metroplex Access Developers by Larry Linson. © Copyright 2000 by L.M. Linson, all rights reserved

2 What is Access? u A nice little desktop database u First popular Windows database u For the novice u For the power user u For the developer u A File Server database with Jet

3 Access can build u A standalone database u A multi-user database u A client linked to ODBC databases u A direct client to SQL Server u A web interface to database

4 Specifically u Microsoft Access 2, 97, 2000 u.MDB or.MDE file format u Jet database engine and Data Access Objects (DAO) u Tables LINKed via ODBC Driver to u Server database (e.g. SQL Server)

5 Specifically NOT u Access Data Project (ADP) u Data Access Pages (DAP) u ActiveX Data Objects (ADO) u Other Web Interface (e.g., Front Page) u ODBCDirect

6 How Many Users? u Multi-User – With everything wrong – 4, 5, or fewer – With everything right – 90 to 150 u ODBC Client – Easily hundreds, limited only by – Concurrent connections to server – Essentially unlimited

7 Multi-User Layout u Tables on Server – Available To All Users u On Users Workstations – Access (or Runtime) – Application Part – Fetch.DLLs, Objects Locally

8 Client-Server Layout u Server Database Engine on Server – Extraction, manipulation done here u On Users Workstations – Access (or Runtime) and Jet database engine – Application »Queries, Forms, Reports, Macros, Modules »Linked TableDefs and Local Tables – ODBC Drivers, ODBC Data Source Information

9 Jet is a File-Server u Retrieve, Extract, and Manipulate on Users Workstation u Every I/O Done Across Network – That would normally be to local hard drive – Not whole database, nor necessarily whole table – Just what Access finds necessary u Index may be enough to find exact records

10 Server Databases u Retrieval, extraction, and manipulation on the Server u Much less Network I/O – (Just) Requests from user to server – (Just) Results from server to user

11 Multi-user Layout... DATA ON SERVER PROCESS ON USER WORKSTATION PROCESS ON USER WORKSTATION... PROCESS ON USER WORKSTATION

12 Client-Server Layout... DATA STORED IN SERVER DB CREATE REQUEST SEND / RECEIVE DATA PROCESS REQEST IN SERVER DB Request & Data U I

13 Comparison... Server (Not Necessarily Windows) Windows U I Data Only Server Database with Data Access, Jet, ODBC Access, Jet

14 Whats Different?... u Data in Server DB – Access User Interface to Server Databases – Performance – potentially better; possibly worse – Corruption – not really a factor u Multiple users of same data –Collisions (Add / Update) – Locking handled on server –Seeing Other Users Update – Refreshing –Updating Related Tables – Transactions handled jointly –Who Am I? – Identify Users to Access and to Server

15 Whats Different?... u Retrieval, extraction, and manipulation on the Server u Fewer Problems – Network failures – Power failures – Individual User and Machine failures Updating

16 Whats Different?... u Access security u Server security – Tables on Server » Accessing, manipulating, updating data Security QueriesMacros FormsModules ReportsLocal Tables

17 Whats Different?... u Rules and triggers at the Server u Dont generate Access error messages u Your application has to have – pre-validation and – user notification Data Validation

18 Whats Different?... u As defined by Server database u Server types may – match directly to Access types – not have Access counterpart » Text date fields – not have all Access types » Counter, OLE, Memo Data Types

19 Whats Different?... u Defined by Server database, – Implemented on Server u Often enforced only by – Triggers » Written manually » Generated by Data Modeler – Some (e.g., Microsoft SQL Server) » Automated, specified similar to Access Referential Integrity

20 Whats Different?... u Most servers do not permit – updating tables joined in SQL u ODBC workaround (sometimes) – Generate / send multiple updates u Pass-through Queries – Must adhere to server specifications Updateable Queries/Views

21 Performance Factors u Hardware Environment »More Memory »Faster Processors »Faster Hard Drives u Software Environment »Not Too Much Else Running u Network Environment » Faster is Better Performance Server is more important than users machine! Not as important as in Multi-User }

22 More Factors... u Reduce Network Traffic –Application Design u Local tables (refresh from server) Use Queries not Tables –Limit both Tables and Columns – Database Implementation u Queries, not DAO Code (When Feasible) u Queries, not RecordsetClone.FindFirst Performance

23 More Factors... u Built-in performance factors – Re-planning query execution u Also called compiling preparing u State of data is important Stored procedures u Like saved Queries in Access u But with logic like code, too Performance

24 More Factors... u Tuning at the Server –Spread data over different disks –Monitor Performance » Analyze » Add, remove, modify indexes –Database Administration » More TLC » Thats why there are DBAs Performance

25 But... u Jet can be smart – Return only part of large recordset – Create separate query for FindFirst u It may save us from ourselves Performance

26 Views u Restrict user access – Only the specified columns – Only the specified rows u Like Access Saved Queries u Appear as Tables to Jet / Access u Also assist performance – Force joins and selection at server Data Integrity

27 Record Locking... u Done co-operatively in C/S – Jet passes the request – Locking actually done by the server – Considerations same as Multi-User » Except: you may lock out more users » May be a smaller time window for some u So, lets just fly through – the repeated slides Data Integrity

28 Record Locking... u In Bound Forms – No Locks (aka Optimistic Locking) » Only in the instant the record is saved – Edited Record (aka Pessimistic Locking) » As soon as user begins to edit – All Records » All records in the entire recordset » Batch Updates » Administrative Maintenance Data Integrity

29 Record Locking... u Possibilities by Object – All Three Options »Table datasheets; Select, Crosstab, Union Query, Forms, OpenRecordset – Lock Edited Record or All Records » Update, Delete, Make-Table, Append – Lock All Records »Data Definition Queries – No Locks or Lock All Records » Reports Data Integrity

30 Record Locking... u Default Record Locking Option – Established by menu Tools | Options u Applies to All, Except – Data Definition Queries – All Records – Open Recordset – Edited Record Data Integrity

31 Record Locking... u OpenRecordset – dbDenyRead or dbDenyWrite – Overrides.LockEdits property – Native Access Tables Only u.LockEdits Property – True = Edited Record (the default) – False = No Locks Data Integrity

32 Record Locking... u Advantages of Pessimistic Locking – Simple to Develop, Prevents Overwriting u Disadvantages of Pessimistic – Lock Multiple Records, Less Concurrency u Advantages of Optimistic Locking – Simple to Use, Better Concurrency, Less Lockout u Disadvantages of Optimistic – Can be Confusing to User, Allows Overwriting Data Integrity

33 Record Locking u Generally, use Optimistic – Minimize User Lockout u Or, Mixed, by Specific Object – Most Optimistic, but – Critical Information, Pessimistic » Example: Quantity on Hand in Inventory Data Integrity

34 Transactions... u Changes in a batch u All Succeed or All Fail u Same or Related Tables –Allocate Stock to Order, Deduct Stock on Hand – Credit New Account and Debit Old Account Data Integrity

35 Transactions... u Server can resolve problems – From failure occurring any time – Full audit trail – Hot backup – second copy of data u No – Orphan locks in.LDB – Data loss, lockout, corruption due to »Errors that occur while committing Data Integrity

36 Transactions u Consider client-server if – Processing funds transactions – Performing critical inventory updates – Etc. – Regardless of other considerations » Performance » Number of users Data Integrity

37 Identifying Users u Typically secure the database – Everyone Logs In u Viewing and Reporting – MSLDBUSR.DLL by Microsoft – Unsupported u Server Security – Log in to connect and link Miscellaneous

38 Some Cautions... u Jet may lose track of record – When using server equivalent of AutoNumber – Data entry works fine – When record saved, all show #Deleted u Countermeasure – Table of tables and next id number – Stored procedure to return next id – Never use data entry, always editing Miscellaneous

39 Cautions... u Complex queries – More than two joins – Jet sometimes decides – Brings back a flood of data u Countermeasure – More than two joins, performance slow – Consider creating a view – View appears as Table to Jet – Forces joins and extraction on server Miscellaneous

40 Cautions... u Complex queries (alternative) – More than two joins – Jet sometimes decides – Brings back a flood of data u Countermeasure – Create a passthrough Query – Tells Jet, Hands off! – Forces joins and extraction on server Miscellaneous

41 Cautions... u Order by not a key, not indexed – Order By field must be in Select Clause – Message is erroneous u Countermeasure – May have to make it a key or index – May be able to use a passthrough Query Miscellaneous

42 Cautions... u Some joins wont work in Access Query Miscellaneous tabid tabname colid tabid colname TableName ColumnName. continued Server Tables Access Table

43 Cautions... u Countermeasure – intermediary Miscellaneous tabid tabname colid tabid colname tabname colname Server TablesAccess Tables tabname colname TableName ColumnName Query

44 Resources... u Access 97 Developers Handbook u by Getz, Litwin, Gilbert u published by SYBEX u ISBN: 0 - 7821 - 1941 - 7 u Chap 15 – Developing Client-Server Applications

45 Resources... u Access 2000 Developers Handbook, Volume 2: Enterprise Edition u by Getz, Litwin, Gilbert u published by SYBEX u ISBN: 0 - 7821 - 2372 - 4 u Chap 3 – Developing Client-Server Applications (also other chapters this volume)

46 Resources... u Building Applications with Microsoft Access 97 u Manual, comes with Office Developer or the MSDN Library u publisher: Microsoft u Chapter 10 – Creating Multi-User Databases

47 Resources u Microsoft Office Visual Basic Programmers Guide u Manual, comes with Office 2000 Developer or the MSDN Library u publisher: Microsoft u Chapter 16 –Multi-User Database Solutions


Download ppt "Microsoft Access as an ODBC Client Application A Presentation for the Microsoft Access SIG of the North Texas PC User Group and the Metroplex Access Developers."

Similar presentations


Ads by Google