Delphi 5 中的 Oracle 数据库连接
我使用的是 Delphi 5 版本,我想连接到 Oracle 数据库。我有 TDatabase 组件。 我不知道如何通过Delphi 连接到数据库。请提供连接数据库的步骤。谢谢。
I am using Delphi 5 version and I want to connect to Oracle Database. I am having TDatabase component.
I don't have any idea about how to connect to database through Delphi. Please provide the steps to connect database. thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
TDatabase
组件是BDE(Borland 数据库引擎)
,这是一个已弃用的技术,请尝试使用其他支持 Oracle 的替代方案,例如 ADO 或Zeos
。有关 ADO 的介绍,请查看 Embarcadero 文档。使用 ADO 组件
,如果您选择 Zeos,请选中 < a href="http://zeos.firmos.at/viewforum.php?f=3" rel="nofollow">官方文档。The
TDatabase
component is part of theBDE (Borland Database Engine)
, which is a deprecated technology, instead try using another alternatives which supports Oracle like ADO orZeos
. For an introduction to ADO check the Embarcadero Docs.Working with ADO Components
and if you choose Zeos check the Official documentation.很有趣,我刚刚完成(几分钟前)我的开源原生 Oracle 的移植访问 Delphi 5。
以下是该单元的主要功能:
有关更多详细信息,请参阅此网站和反馈。
您有一个像包装器一样的
TQuery
,可以像使用 BDE 一样编写代码。或者您可以这样编写代码:
不幸的是,Delphi 5 不允许通过变体进行后期绑定,而 Delphi 6 及更高版本允许这样做:
如果您确实想在 RAD 方法中使用 DB 组件,请查看 < a href="http://www.terry.net/pages.php?id=549" rel="nofollow">Torry页面中的相应页面:
您会发现一些旧的免费组件,大部分是在 Oracle 8 时代创建的(SynDBOracle 针对 Oracle 11g 进行了优化,但可以与早期版本的 Oracle 一起使用),但它们可能更适合您在没有 BDE 的情况下连接 Oracle 的需要。
当然,也有一些非常好的商业组件,仍然可以与 Delphi 5 一起使用。但是您必须付出高昂的代价...顺便说一句,最好升级到较新的 Delphi 版本。 ;)
That's funny, I've just finished (some minutes ago) the port of my Open Source native Oracle access to Delphi 5.
Here are the main features of this unit:
See this web site for more details and feedback.
You have a
TQuery
like wrapper, to write code just like with the BDE.Or you can write code as such:
Unfortunately, Delphi 5 do not allow late-binding via a variant, which is allowed with Delphi 6 and up:
If you really want to use the DB components in a RAD approach, take a look at the corresponding page in Torry's page:
You'll find there some old free components, mostly created at Oracle 8 time (SynDBOracle is optimized for Oracle 11g but will work with earlier versions of Oracle), but which may better suit your need for Oracle connection without the BDE.
Of course, there are also some very good commercial components around, still working with Delphi 5. But you'll have to pay the high price... and should better upgrade to a newer Delphi version, by the way. ;)
如果您有 Delphi 5 企业版,您可以使用 BDE 和 Oracle SQL Link 连接到 Oracle。这是从 D5 使用 Oracle 的最快方法。如果您有专业版,则可以通过 ODBC 使用 BDE 使用 Oracle。企业版也应该已经有 ADO 组件,但在我的测试中,它是一个比 SQL 链接差的解决方案,尽管如果您必须稍后移植到较新的 Delphi 版本,它仍然受支持,而 BDE 和 SQL 链接是不是。
帮助和手册中详细介绍了连接步骤。
If you have the Enterprise version of Delphi 5 you can connecto to Oracle using the BDE and the Oracle SQL Link. That's the fastest way to use Oracle from D5. If you have the Professional version, you can use Oracle using the BDE through ODBC. The Enterprise version also should already have the ADO components, but in my tests then it was an inferior solution to the SQL Links, although if you have to port later to a newer Delphi release it is still supported while the BDE and the SQL Links are not.
The steps to connect are detailed in the help and the manuals.