许多软件公司都理解开发不依赖于特定数据库类型(例如,Oracle , SQL Server ,DB2)的应用程序的重要性,它可以让客户们选择自己习惯的平台。一般来说,软件开发人员都能够识别出他们的负责数据库维护的客户,和必须使用现有平台和个性化的客户。
关于Oracle和SQL Server之间的区别,已经有很多篇文章从企业的角度和数据库管理员的角度出发描写了两者之间的一般差别。在这篇文章里面,我将会从应用程序的角度向你描述SQL Server 和Oracle平台之间的区别,并且将会讨论开发不依赖于数据库环境的应用程序的几种可能的方法。
与此同时,我不会再论讨对于应用程序来说,两个平台之间显而易见的区别,例如表的分割和索引。
定义通用接口和语言
有很少的几种通用语言和接口可以让应用程序不依赖于数据库,想来也可以以同样的方式应用在关系型数据库上面:
ANSI是美国国家标准局定义的,这是一家志愿者成员的组织(用私人基金运转),他们在有关设备和程序等广泛领域内开发了国家承认的标准。在数据库领域,ANSI定义了编写SQL 命令的标准,假设命令可以运行在任何的数据库上,而不需要更改命令的语法。
ODBC是开放数据库连接(ODBC)接口,微软定义的,它可以让应用程序访问数据库管理系统(DBMS)中的数据,使用SQL 作为访问数据的标准。ODBC允许最大的互联性,这意味着一个单个的应用程序可以访问不同的数据库管理系统。然后,应用程序终端用户可以添加开放数据库连接(ODBC)数据库驱动来将应用程序与他们所选择的数据库管理系统链接上。
OLEDB,是ODBC的继承者,是一组允许例如基于VB,C++,Access等任何可以连接到类似SQL Server ,Oracle ,DB2,MySQL等后台的“前台”的软件组件。在许多种情况下,OLEDB组件都比原有的ODBC提供了好得多的性能。
JDBC(Java数据库连接)应用程序接口是Java编程语言和广泛范围的数据库,SQL 数据库和其他表列数据源(例如电子表格或者普通文本文件)之间,进行不依赖于数据库的连接的行业标准。JDBD应用程序接口为基于SQL的数据库访问提供了调用级别的应用程序接口。
真实世界中的通用接口
不幸的是,并不是所有数据库级别的命令都是ANSI,每个数据库平台都有自己的扩展功能。ANSI,或者通用接口,一般来说都代表着几本功能,因此也可能意味着丧失了性能方面的竞争力。对于小型数据库和小型应用程序来说,要维护对数据库的通用访问是简单的,但是当数据库和/或应用程序变得越来越大,越来越复杂,你就不得不向代码中添加功能。
示例:
在两个平台上以同种方式编写的命令: Insert into Table_1 values (1,'Michelle')
Update Table_2 set Col_1 = 2
Delete from Table_3 where Col_3 like 'Michelle%'
在两个平台上不是以同种方式编写的命令: Select getdate()
Select case Fld when 1 then 'a'
When 2 then 'b'
Else 'c'
End
From Table_4
Oracle
Select sysdate from dual
Select DECODE (Fld, 1, 'a', 2, 'b', 'c')
From Table_4
下面的两篇文章包括了对Oracle PL/SQL命令和T-SQL命令比较的列表:
? 从Oracle移植到SQL Server
? 开始学SQL: SQL Server和Oracle之间的区别
65.110.43.* 于 2006-12-08 04:42:00发表:
Good design!
monopoly online | world series of poker | poker gambling | aussie slots | casino games | play free slot machine game | flash casino | best online casinos | free slot downloads | crazy game of poker
65.110.43.* 于 2006-12-08 04:41:40发表:
Nice site!
poker pages | black jack online | poker casino | gambling on line | slots for free | poker us welcome | free games on line | earn cash playing poker | online poker tournament | online poker rating room
65.110.43.* 于 2006-12-07 07:11:21发表:
Nice site!
casino online | free slot machines games | free bonus slots | internet poker game | no deposit bonus casinos | world poker tour | free online texas hold em | playing poker | casino bonus | best internet casinos
65.110.43.* 于 2006-12-07 07:09:19发表:
Good design!
black jack games | free poker software | poker rooms accept us | slot games free | online poker | poker review star | free money no deposit casinos | slot machine | blackjack online | free video poker
65.110.43.* 于 2006-12-07 07:08:38发表:
Thank you!
playing roulette | casino on line | free no deposit online casinos | blackjack games | online slots | on line casino | empire poker | online gambling | texas hold em poker online | multi player poker
65.110.43.* 于 2006-12-07 07:08:17发表:
Good design!
free casino | virtual poker | no limit holdem | strip black jack | free online slots no download | poker games free | video poker download | casino download | flash casinos | keno online
65.110.43.* 于 2006-12-07 07:07:59发表:
Well done!
gambling poker | slots for free | black jack download | free gambling games | paigow poker | gamble poker | games slots | free games on line | play online poker | free slot
65.110.43.* 于 2006-12-06 01:30:44发表:
Thank you!
card poker | poker sites accept us | free on line poker | keno games | free black jack games | party poker | poker party | video poker | poker online free | free roulette
65.110.43.* 于 2006-12-06 01:28:56发表:
Well done!
no download casino | internet casino gambling online | internet blackjack | best internet poker | free slots | poker cards | free money no deposit casinos | free on line games | texas holdem tournament | party poker bonus
65.110.43.* 于 2006-12-06 01:28:17发表:
Thank you!
casino bonus | omaha poker | no deposit bonus casinos | draw poker | on line casinos | online poker | free bingo cards | play free slot machines | free slots online | gambling poker
65.110.43.* 于 2006-12-06 01:27:55发表:
Great work!
online slots | video slot games | slim slots | free omaha poker | free slot downloads | pacific poker | free monopoly slots | video poker machines | online hold em | free poker
65.110.43.* 于 2006-12-06 01:27:36发表:
Nice site!
gambling games | free poker tournaments | casino portal | poker game download | paigow poker | slot machines | flash casino games | online poker room | gambling poker machine | poker open to us
65.110.43.* 于 2006-12-05 01:20:34发表:
Thank you!
paradise poker | free on line slots | blackjack online | online gaming casinos | free online casinos | world poker | russian roulette game | black jack game | free strip blackjack | full tilt poker
72.232.93.* 于 2006-12-05 01:19:24发表:
Great work!
internet bingo | poker casino | best poker sites | poker sites | online gambling games | flash casino games | texas hold em | card poker | free multi line slots | play poker on line
72.232.93.* 于 2006-12-05 01:18:49发表:
Thank you!
online poker rooms | strip blackjack | online black jack | free slot machine play | internet gambling | free three card poker | best casinos | world series of poker | poker for free | free casino bonus
65.110.43.* 于 2006-12-05 01:18:27发表:
Great work!
planet poker | free fun slots | holdem poker texas | no limit hold em | poker hand | free casino cash | online poker | poker games free | free online casino slots | computer poker games
72.232.250.* 于 2006-12-05 01:18:09发表:
Nice site!
poker tournament | internet casinos | play bingo | free video slots | caribbean poker | play black jack | world poker tour | free slot machines | machine games | internet poker
65.110.43.* 于 2006-12-04 01:34:59发表:
Great work!
machine games | poker texas hold em | poker game online | poker machine | online poker software | online poker sites | holdem poker texas | play slots | no limit texas holdem | slots for free
65.110.43.* 于 2006-12-04 01:33:52发表:
Thank you!
online poker rooms | casino on line | free poker software | gambling machines | slot machine games | online casinos | internet bingo | game poker | casino game | paradise poker
65.110.43.* 于 2006-12-04 01:33:22发表:
Nice site!
free video slots | play blackjack online | play poker | roulette wheel | poker rooms accepting usa | free blackjack online | casino games | poker game | russian roulette game | play casino game
72.232.250.* 于 2006-12-04 01:33:04发表:
Nice site!
slots games | online casino | easy online real bingo | multiplayer poker | free online slots | online gambling holdem | multi player poker | casino games free | blackjack games | free strip blackjack
72.232.93.* 于 2006-12-04 01:32:43发表:
Great work!
games slots | free online video slots | internet poker game | cleopatra slot machine | online free poker | free online poker | sim slots | gambling casinos | free online poker games | new no deposit online casinos
72.232.93.* 于 2006-11-30 08:25:05发表:
Well done!
russian roulette game | online poker games | free online casino slots | poker accepting americans | poker machine | casino on net | gambling casinos | slots online | free blackjack online | free poker
65.110.43.* 于 2006-11-30 08:14:09发表:
Good design!
new no deposit online casinos | pai gow poker | best poker sites | draw poker | online texas hold em | free casino cash | casino games free | casino portal | gambling sites | slots free
72.232.250.* 于 2006-11-30 08:03:09发表:
Well done!
casino game online | paradise poker review | free online bingo | free gambling | no download no deposit casinos | poker room review | multi hand poker | omaha poker | stud poker | monopoly slot machine
65.110.43.* 于 2006-11-30 07:52:24发表:
Nice site!
play free roulette | free slot play | online black jack | pacific poker | cleopatra slot machine | blackjack free | video poker download | casino slot machine | world poker tour | free multi line slots
72.232.93.* 于 2006-11-30 07:45:23发表:
Great work!
black jack game | free slot games online | play free slot machines | casinos with no deposit | play online poker | blackjack odds | playing poker | free poker on line | free no deposit online casinos | internet casino
72.36.178.* 于 2006-11-29 11:32:41发表:
Well done!
My homepage | Cool site
flycocoon 于 2006-11-05 00:46:50发表:
可能的解决方案:
我曾见过几种对数据库互操作性问题的可能的解决方案:
[table=467][tr][td]#[/td][td]解决方案描述[/td][td]优点[/td][td]缺点[/td][/tr][tr][td]1[/td][td][font=宋体]处理两种版本的应用程序----一个是针对[/font]Oracle[font=宋体]的,另一个是针对[/font]SQL Server[font=宋体]的。[/font][/td][td]1.[font=宋体]不需要处理[/font]SQL[font=宋体]命令的版本[/font][/td][td]1. [font=宋体]复制代码[/font]--[font=宋体]必须在两个版本上应用所有的变化。[/font][/td][/tr][tr][td]2[/td][td][font=宋体]尽可能地使用通用语言([/font]ANSI/ODBC/OLEDB/…[font=宋体]),并且在应用程序用[/font]IF[font=宋体]命令处理不同的命令[/font][/td][td]1. [font=宋体]处理单个应用程序[/font][/td][td]1. [font=宋体]如果有非[/font]ANSI[font=宋体]的命令,代码就会变得越来越大[/font], [font=宋体]这会影响应用程序的性能[/font] 2. [font=宋体]代码可能会因为很多的[/font]IF [font=宋体]语句变得复杂。[/font][/td][/tr][tr][td]3[/td][td][font=宋体]把数据库命令保存在数据库或者[/font]INI[font=宋体]文件中,当应用程序开始的时候将其读入缓存。[/font][/td][td]1. [font=宋体]应用程序中不需要[/font] IF[font=宋体]命令了。[/font]2. SQL [font=宋体]命令可以任意修改,并且不需要在修改之后重新编译应用程序。[/font][/td][td]1. SQL[font=宋体]命令管理可能变得更加复杂。[/font][/td][/tr][/table][/size]
[size=3] 选择哪个解决方案?
这个问题的答案依赖于应用程序的特性和平台。每个解决方案都易于实现,这里没有最好的解决方案。
结论:
如果你想要将你的应用程序开发成为不依赖数据库的,你就应该仔细的计划解决方案。考虑到应用程序在数据库级别上的复杂性,还有所需代码的总量。在计划过程中,考虑到应用程序未来的发展是至关重要的。