简体   繁体   English

用C++连接oracle数据库

[英]Connect to oracle database with C++

I am looking for a way to connect to an remote oracle database and read some data from table within a c++ console application.我正在寻找一种方法来连接到远程 oracle 数据库并从 C++ 控制台应用程序中的表中读取一些数据。 Can some one give me some hints.有人可以给我一些提示。 Thnx.谢谢。

soci, http://soci.sourceforge.net , is a reasonably modern C++ interface that uses the Oracle call interface. soci, http: //soci.sourceforge.net,是一个相当现代的 C++ 接口,它使用 Oracle 调用接口。 And can also connect to other databases ...并且还可以连接其他数据库...

The official Oracle website proposes several resources. Oracle 官方网站提供了多种资源。 Amongst others:在其他人中:

Just google, there are really plenty of tutorials around.只是谷歌,周围真的有很多教程。

You can try: CODBC .您可以尝试: CODBC It is an API for Pro*C .它是Pro*C的 API。 Pro*C is a very decent way to connect Oracle and C++. Pro*C是连接 Oracle 和 C++ 的一种非常体面的方式。

You can either use the Oracle C++ Call Interface (native API) or the Open DataBase Connectivity API .您可以使用Oracle C++ 调用接口(本机 API)开放数据库连接 API If you want a more high-level wrapper, there are some more convenient interfaces in libraries such as Qt .如果你想要一个更高级的包装器,在诸如Qt 之类的库中有一些更方便的接口。

You can use OCCI: http://www.oracle.com/technetwork/database/features/oci/index-090820.html您可以使用 OCCI: http : //www.oracle.com/technetwork/database/features/oci/index-090820.html

or OCI: http://www.oracle.com/technetwork/database/features/oci/index.html或 OCI: http : //www.oracle.com/technetwork/database/features/oci/index.html

or one of many other APIs available.. It really depends on the type of thing you're going to use it for.. You should find a lot of information about the pros/cons of the various APIs through google..或许多其他可用的 API 之一.. 这实际上取决于您将使用它的类型.. 您应该通过谷歌找到大量有关各种 API 的优缺点的信息..

Unless it's study purpose or strict requirement with ORACLE DB, I'd suggest you to work with generic classes/services provided with various Microsoft Framework.除非是出于学习目的或对 ORACLE DB 的严格要求,否则我建议您使用各种 Microsoft 框架提供的通用类/服务。

目前(2021)积极开发也是OCILIB ,我能够在短时间内设置测试示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM