What is a good api to sql from visual c++ - c++

I want to do simple stuff like adding entries and reading entries by index. What libraries are there and which ones are the best?

SQLite would be a good simple SQL database engine, with a simple embedded C++ interface.
SQLAPI++ would be a good choice for many commercial SQL databases (Oracle, SQL Server, DB2, Sybase, Informix, InterBase, SQLBase, MySQL, PostgreSQL, SQLite and ODBC)

One option is to use Microsoft's SQL Server Compact Edition. It is free, and has Visual Studio integration.
You can download it and find out more at the following link:
SQL Server Compact Edition

If you not worried about HUGE concurrency then use SQLite (www.sqlite.org). Download the aggregated version and you only have 2 files: sqlite3.h and sqlite3.c. It's REALLY easy to use and requires no server set up or configuration.

Related

Any ole db provider/consumer for PostgreSQL?

I'm working with c++ visual studio 2015, currently i'm using sql server for database but now i'm switching on postgres DB but i'm not getting any relevent OLE DB consumer/provider please suggest.
You can either work with PGNP OLEDB Provider for PostgreSQL, Greenplum and Redshift or use a combination of Microsoft OLE DB Provider for ODBC and psqlODBC.
Although the second combination involves more components (and, probably, more layers), it's probably more up-to-date.

Sync Framework 2.1 Local Cache as SQL Server Possible?

Could someone please help me with whether it's possible to use a full blown SQL Server as Local Database Cache instead of CE?
The reason being CE has 4GB limit. CE is not an option for us as our database records will grow significantly within few months.
Any alternative solution will be much appreciated.
if you're referring to the Local Database Cache project item in Visual Studio, the answer is no. Only Sql Compact (SqlCeClientSyncProvider) is supported by that wizard. You can however handcode your own provider and the sync code without using the wizard.
or you can just use the SqlSyncProvider (can be used against Sql Express, Sql Server, Sql Azure).
see: Synchronizing SQL Server and SQL Express

Is there any way to connect to oracle db using simple c++ not vc++ or proc

I am struggling to connect to oracle db using GNU C++.Is there any library which I have to install to connect to oracle db using simple c++ (oops).
Please provide me some sample code as well, this is new for me. Appreciate your help.
I asked a similar question before but forgot to mention that I am not using vc++ and proc.
You would need the oracle C++ libraries (OCCI) from oracle. You can find them here:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
Google "Oracle OCCI tutorial" and you should find pretty much everything you need.
Check out SOCI. It supports several database backends, including Oracle, MySQL, Postgre, ODBC, etc. Using this library would make it easier for you to migrate your application to a different DB, if necessary.
There's a code sample here. And several more peppered in the documentation.

Connecting to oracle database using C++, the basics

i have a question about the theory here, i'm just starting a project which is based on C++ applications integrating with oracle DB's, i've came to two choices, OCCI, and OCI
the OCCI is said to be aimed at C++ environment, but i was wondering, if it would be any good to use the OCI libraries from my C++ app since it is said to have better performance, or would i run into compatibility issues ?
thanks in advance :)
You can have a look at OTL it's a wrapper above the OCI or OCCI (not sure) will give some templates and samples to start with oracle connection in c++.
In my case, my company have about a thousand stores.
To connect Oracle / Oracle thru an MS C++ multi-thread service we perform the following tests on each thread:
Validate DNS (gethostbyname)
Try to open SCManager of the store (OpenSCManager)
Verify if Oracle Service exists on the store (OpenService)
Verify if Oracle Service is running (QueryServiceStatus)
After all, we try to connect (ado->Open)
This procedures minimize possible errors like 0xE06D7363 when connecting to a external server.

Connecting and Fetching a record form sequel server 2005

I have a windows application in visual C++. I am not using MFC, in this application I have connect to SQL server 2005 and fetch records form a database file. Can any one guide me how this can done. Thanks in advance.
I would say, you could use some wrapper framework around the odbc calls. Currently I was working on a project where SQL server communication was involved so I found this wrapper framework: TinyODBC which is a minimalistic ODBC wrapper library. It's pretty trivial how can one use it, but I have to admit I had to patch it for a little more functionality. But otherwise it is a useful choice of ODBC communication. Now, you can use the native SQL driver via ODBC. Since it's a minimal framework, if you go through the tutorial you'll be ready to create new application with it.
Now
The complete list of accessing methods is listed here. Most popular choices for C++ programmers are SQL Server Native Client and MDAC/Windows DAC, both support OLEDB and ODBC interfaces. A comparison of SQL Server Native Client and MDAC/WIndows DAC is here.
There are other wrappers built on top of OLEDB and ODBC such as ADO or TynyODBC, which can help you to write more readable code.