以可移植的方式使用 DB Api
我需要开发某种应用程序并在其中使用数据库。
假设我目前想在 Windows 上开发它,但是,几个月后我可能必须将其迁移到 Linux。
我开始阅读一些相关内容,但无法找到我需要的内容。
是否有用于使用 DB 的通用/可扩展/标准 api?
我读到有 ODBC、JDBC、iOBDC、unixODBC 吗?为什么所有这些都存在?
有人可以帮助我理清思路并纠正这个问题吗?
编辑 - 我正在使用 C++ - 所以请建议这个方向,即使我会欣赏跨语言/跨平台的建议
I need to develop some kind of application and use DB in it.
Let's say i want to develop it over Windows currently, however, in a couple months i may have to migrate it to Linux.
I started reading a little bit about it, but couldn't get to point i needed.
Is there or isn't a generic/protable/standart api for using DB ?
I read there is ODBC,JDBC, iOBDC,unixODBC ? why all of these exist ?
Can someone help clearing and setting my head straight regarding the issue ?
Edit - I'm using C++ - so please advise to that direction, even though i'll appreciate inter-language/inter-platform recommendations
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一堆用于通用数据库访问的 C++“包装”库,这是我的一些想法:
这两个都源于 Oracle 特定的工作,但现在至少支持几个其他数据库。
当然,您无法真正隐藏供应商差异,但这是一般的泄漏抽象法则。
There's a bunch of C++ "wrapper" libraries for generic DB access, here's couple of top of my head:
Both of these grew out of Oracle-specific work, but support at least several other databases now.
Of course you can't really hide vendor differences, but that is general law of leaky abstractions.
只需将 JDBC API 与 JDBC 驱动程序结合使用即可。不要使用 ODBC(桥接)驱动程序。
Just use the JDBC API in combination with a JDBC driver. Do not use the ODBC (bridge) driver.
如果您的数据库负载不是很重,我建议您使用SQLite。您只需要一个头文件和一个源文件(合并版本)。而且它非常便携。
我一直在 Windows 和 Linux 上使用它。
I recommend you using SQLite if your DB load is not very heavy. you need only one header file and one source file only(amalgamation version). and It's highly portable.
I have been using it on Windows and Linux.