跨平台数据库连接的标准是 ODBC。然而,这是一个非常大的 C API,可能需要一些时间来适应(但一旦习惯了它就可以很好地工作)。有很多 C++ 包装器库,但我不能推荐其中任何一个,因为我一直使用自己的包装器。使用 https://stackoverflow.com/search 上的 SO google 搜索搜索“c++ 数据库库”,可以看到很多关于这个话题。
The standard for cross platform database connectivity is ODBC. However, this is a very large C API which can take some getting used to (but works well once you are used to it). There are a lot of C++ wrapper libraries for it, but I can't recommend any of them as I've always used my own wrapper. Do a search for "c++ database library" using the SO google search at https://stackoverflow.com/search to see lots of questions on this topic.
There is no equivalent in C++. ODBC is the closest thing.
However, ODBC is more than a database interface (Call Level Interface), it also defines an underlying connection protocol so you will need a middle-ware or driver on the database server-side to use ODBC.
On the other hand, JDBC is simply a standard programming interface and it can communicate to database using native protocols without any drivers. Some JDBC implementations talks to database through ODBC (so called JDBC-ODBC bridge driver).
发布评论
评论(3)
跨平台数据库连接的标准是 ODBC。然而,这是一个非常大的 C API,可能需要一些时间来适应(但一旦习惯了它就可以很好地工作)。有很多 C++ 包装器库,但我不能推荐其中任何一个,因为我一直使用自己的包装器。使用 https://stackoverflow.com/search 上的 SO google 搜索搜索“c++ 数据库库”,可以看到很多关于这个话题。
The standard for cross platform database connectivity is ODBC. However, this is a very large C API which can take some getting used to (but works well once you are used to it). There are a lot of C++ wrapper libraries for it, but I can't recommend any of them as I've always used my own wrapper. Do a search for "c++ database library" using the SO google search at https://stackoverflow.com/search to see lots of questions on this topic.
ODBC 是问题 1 的答案。(JDBC API 是根据 ODBC 建模的。)
ODBC it the answer for question 1. (The JDBC API was modeled after ODBC.)
C++ 中没有等效的东西。 ODBC 是最接近的东西。
然而,ODBC 不仅仅是一个数据库接口(调用级接口),它还定义了一个底层连接协议,因此您需要数据库服务器端的中间件或驱动程序才能使用 ODBC。
另一方面,JDBC 只是一个标准编程接口,它可以使用本机协议与数据库进行通信,无需任何驱动程序。一些 JDBC 实现通过 ODBC(所谓的 JDBC-ODBC 桥驱动程序)与数据库通信。
There is no equivalent in C++. ODBC is the closest thing.
However, ODBC is more than a database interface (Call Level Interface), it also defines an underlying connection protocol so you will need a middle-ware or driver on the database server-side to use ODBC.
On the other hand, JDBC is simply a standard programming interface and it can communicate to database using native protocols without any drivers. Some JDBC implementations talks to database through ODBC (so called JDBC-ODBC bridge driver).