欢迎来到天天文库
浏览记录
ID:34452454
大小:212.92 KB
页数:34页
时间:2019-03-06
《第15章 数据库应用结构与数据访问接口_2new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Chapter15DatabaseInterfaceChapter15-Objectives¢Introducetothemethodsofaccessdatabaseinapplications:¢EmbeddedSQL¢DatabaseInterface¢ODBC¢OLEDBandADO¢JDBCInteractivevs.Non-InteractiveSQL¢InteractiveSQL:SQLstatementsinputfromterminal;DBMSoutputstoscreen¢Inadequateformostuses¢Itmaybenecessarytop
2、rocessthedatabeforeoutput¢Amountofdatareturnednotknowninadvance¢SQLhasverylimitedexpressivepower¢Non-interactiveSQL:SQLstatementsareincludedinanapplicationprogramwritteninahostlanguage,likeC,Java,COBOLApplicationProgram¢HostlanguageHostlanguage:Aconventionallanguage(e.g.,C,Java)thatsupplies
3、controlstructures,computationalcapabilities,interactionwithphysicaldevices¢SQL:suppliesabilitytointeractwithdatabase.¢Usingthefacilitiesofboth:theapplicationprogramcanactasanintermediarybetweentheuserataterminalandtheDBMSIntroducingSQLIntotheApplication¢SQLstatementscanbeincorporatedintoana
4、pplicationprogramintwodifferentways:¢StatementLevelInterface(SLI):ApplicationprogramisamixtureofhostlanguagestatementsandSQLstatementsanddirectives(embeddedSQL).¢CallLevelInterface(CLI):Applicationprogramiswrittenentirelyinhostlanguage¢SQLstatementsarevaluesofstringvariablesthatarepassedasa
5、rgumentstohostlanguage(library)proceduresStatementLevelInterface¢SQLstatementsanddirectives(embeddedSQL)intheapplicationhaveaspecialsyntaxthatsetsthemofffromhostlanguageconstructs¢e.g.,EXECSQLSQL_statement¢PrecompilerscansprogramandtranslatesSQLstatementsintocallstohostlanguagelibraryproced
6、uresthatcommunicatewithDBMS¢HostlanguagecompilerthencompilesprogramCallLevelInterface¢Applicationprogramwrittenentirelyinhostlanguage(noprecompiler)¢Examples:JDBC,ODBC,OLEDB,ADO,ADO.NET¢SQLstatementsarevaluesofstringvariablesconstructedatruntimeusinghostlanguage¢SimilartodynamicSQL¢Applicat
7、ionusesstringvariablesasargumentsoflibraryroutinesthatcommunicatewithDBMS¢e.g.executeQuery(“SQLquerystatement”)EmbeddedSQLEXECSQLBEGINDECLARESECTION;unsignedlongnum_enrolled;charcrs_code;charSQLSTATE[6];VariablessharedbyEXECSQLENDDECLARESECTION;hostandSQ
此文档下载收益归作者所有