C20.0046 Database Management SystemsLecture #18.ppt

C20.0046 Database Management SystemsLecture #18.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C20.0046 Database Management SystemsLecture #18.ppt

M.P. Johnson, DBMS, Stern/NYU, Sp2004 C20.0046: Database Management Systems Lecture #18 Matthew P. Johnson Stern School of Business, NYU Spring, 2004 Agenda Previously: Pro*C Next: Project part 3 is due next week More programming for SQL Embedded SQL Pro*C, SQLJ PSMs CLI SQL/CLI in C JDBC in Java DBI/DBDs in Perl PHP (HTML?) Recap: Embedded SQL Limitation of embedded SQL Okay for apps with a fixed set of queries/updates Maybe very simple kiosks But consider, say, sqlplus or the sqlzoo website Processes arbitrary queries from user Can we do this with embedded SQL? Dynamic SQL In dynamic SQL, query string can be taken as a parameter, passed to DB Two steps: Prepare: compiles/optimizes the string Execute: executes the query Combine together: EXECUTE IMMEDIATE But separate if query is executed many times (why?) Something like the sqlplus program could be written as a simple dynamic SQL future homework idea? Dynamic SQL myquery = a SQL variable not prefixed by : Dynamic SQL example Example script: sample8.pc See Pro*C tutorial Goal: find employees from department 10 Start with query as string Sketch of sqlplus/mysql Dynamic SQL example 2 Example script: sample10.pc See Pro*C tutorial Goal: recreate sqlplus/mysql Copy-able commands: /~mjohnson/dbms/eg/lec18/proc.txt Next topic: SQL/CLI Pro*C converts EXEC SQL code --into what? If we know the API (“Call-Level Interface”), can call library routines by hand Is this better or worse? Pros cons Won’t cover in depth CLI: Java CLI - Overview Similar to what really happens in embedded SQL implementations. Major approaches: SQL/CLI - standard of ODBC JDBC (Java database connectivity) See /info/middleware.html for many options Advantages over embedded SQL: Avoid preprocessor-stage, easier to debug In th., use same program with several DBMS Disadvantages: Must keep up to date with API changes DBMS may have conflicting APIs Next topic: JDBC (Java’s CLI) As expected: Java too can talk to SQL In some ways: much nicer

文档评论(0)

gshshxx + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档