MSSQL c++ connector - c++

I am looking for a way to connect to a MS SQL database from a unmanaged C++ program.
The only thing that I found is http://www.sqlapi.com/, but this is payed, any idea of a free alternative?
Also I would like a solution that has both a Linux and Windows connector.

How about standart API: ODBC?
You may see a good example of connector in this link:
http://cs.dvc.edu/HowTo_SQL.html
But there are a string:
char db[] = "myDatabase"; // ODBC database name
It isn't a database name, it's name of server. For example: MSSQLSERVER.

Related

is there a way of hosting a mysql database using only Qt?

I am trying to make a program that connect many computers into a local MySQL database hosted by a central computer, but the way I found to host a MySQL database is using an External program as Xampp or WampServer. I am Wodering if I can host a MySQL database using only Qt's classes like QTcpServer without the needing of external programs.
No. MySQL needs a MySQL Server process to manage connections, permissions, SQL parsing, storage engines, caching, etc. You can't use a MySQL database without a MySQL Server.
You might like to explore using SQLite, which is a free embedded database that can be used without requiring a separate daemon process. SQLite is a different product than MySQL, so there will be differences in its implementation of some SQL language features. Be sure to study the SQLite documentation: https://sqlite.org/docs.html
I did a quick Google search (my search phrase was "qt with sqlite") and I found numerous blogs and tutorials about how to use SQLite in an application with Qt. Here's just the first result, but there are others: https://katecpp.github.io/sqlite-with-qt/

What is a good api to sql from visual 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.

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.

Possible to access WMI through ADO?

Is there an OLEDB provider for WMI/WBEM?
In other words, could someone access WMI through:
ADO in shell vbscript
ADO in ASP script
ADO in Win32 native process
SQL Server linked server
SQL Server OPENROWSET()
Is there an OLEDB provider for WMI/WBEM?
Is it possible to access WMI through ADO?
i hear rumors that an ODBC driver exists for WMI, but i cannot see it installed on my machine. Plus, i'm asking about OLEDB (and ADO that wraps it).
The answer is: No
There used to be an ODBC WMI adapter for Windows 2000 Server as an optional installation. (see here). It is not supported on later Windows versions (see here).
It would be too much work to wrap every class in WMI to OLDEB tables. Number of WMI classes exploded in the XP/2003 timeframe. If you are only focusing on certain classes, you can write your own OLEDB provider that calls WMI and returns the data.

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.