How to create a database in Clion using C++? - c++

I have a already created game and want to include a login system using a real database, no files. The game is written in C++ with SFML in Clion. I am also on Linux Mint.
I am new to this so I am wondering how to go about it. What kind of tools would i use? Hope this question is not to close asking for recommendation. I just don't know where to start.

Easiest way is to use SQLite. You can read about it here - https://www.sqlite.org/capi3ref.html
But if you want "real" SQL database, you can go with MySQL - http://dev.mysql.com/doc/refman/5.7/en/c-api-function-overview.html

Related

Connect an SQL to c++ project in visual studio 2015

I'm writting a tic-tac-toe game in c++ and I want to create a hight scores view. The problem is I'm new to DB and now just theory of SQL.
So, how can I add a simple SQL table to my c++ project?
(id INTEGER PRIMARY KEY, name TEXT, hightScore INTEGER)
Looks like just adding to project SQL script file and creating this table not gonna work. How to connect it with my cpp files? Where and how I'll be able to make an INSERT after each new game was played?
Thanks in advance!
To have a simple table you'll need to have a database to set the table up within. The library you will use to communicate with the database is going to depend on which database you are running.
Setting up the needed libraries usually means installing them and updating your linker. This will require some research and effort on your part to make it work, depending on what your particular configuration is.
some ideas:
(for mysql there is mysql/mysql.h which is a free library. )
How to make #include <mysql.h> work?
(for other SQL databases (not free))
http://www.sqlapi.com/
(possible free alternative to sqlapi )
Free alternative to SQLAPI++?
Hopefully that will get you started in the right direction! Good luck.
I have researched about c++ database connectivity and i could find following ways to connect to SQL server database from c++ project.
Using Microsoft's ODBC connection method. Which is a little bit complicate method and requires thorough research to use further.
Ref: https://www.techhowtos.com/programming/how-to-connect-to-sql-server-from-visual-c-plus-plus/
Using SQLAP++ Library which is very convenient way to connect to a databse . It Requires to purchase one time license to use commercially.
Using CPPCMS project's CppDB library.

How can I learn array database Rasdaman easily?

I'm working at VietNam - HaNoi National University and I've a research at BigData satellite raster image by array database.
A solution is using Rasdaman database which has been developed many years. I've installed this server successfully, try to make some query with this by using this guide from rasdaman.org. Everything should be ok but I've known that this has a GUI tool name Rview.
I can't search Rview from any where (may be it's too old), I need some GUI tool because I some time don't really know what is error in my query and I need some tool that can show me the result (2D, 3D) with interractive viewer.
Please tell me how can I get a tool that can have GUI as MS SQL Database management tool, Phpmyadmin,...
Rview (recently renamed to rasdaview actually, to avoid clashing with vim) is a GUI client for rasdaman that allows to send queries and has some cool visualization capabilities for 1D to 3D data.
The problem with rasdaview is that it has been last compiled 10+ years ago against wxWidgets 1.6x and the code is so outdated and incompatible with recent wxWidgets that it's not possible to compile it anymore without significant rewriting.
So rasdaman comes with this rview binary, which amazingly still works on most systems today. However, since it's not possible to compile it, it's a bit tricky to get it running. These guidelines should help you.
Are you looking for a website where you can execute your DDL or DML statements?
If yes then try SQL Fiddle.

C++ qt embedded mysql server

I'm using QT 5 with MingW 4.7 and i'm trying to start a program with an embedded mysql server.
My current program uses a mysql server, but the server has to be manually started (so out of the program). This isn't user friendly of-course.
I did some research and I need to use the libmysqld library . But I don't know how.
Can anyone give me an example how to use this?
You can use an embedded mysql server within Qt. There are no that many difficulties with that at all. If you could point any you faced I can help you with that, indeed you should link your application with libmysqld and then just start a mysql process within your application (there are plenty documentation available about that). But as was pointed in comments - are you sure you want to do that. There are many nicer embedded solutions available like SQLLite (included in Qt)...
Documentation and examples
You probably will need to have a look on mysql driver supplied with Qt and may be fork it for embedded version, but that needs a bit closer look. But again I don't see really issues with that

How to connect to mysql using wxwidget?

Hello I am new to wxwidgets and dont know how to connect to the mysql database. I was wondering if any one could give me some hint or simple program sample. Thanks
You connect to a mysql db in just the same was as from any C++ program. wxWidgets is irrelevant.
There are lots of ways to achieve what you want. You will have to hunt around to find what works for you. Here is a stackoverflow question to get you started.

Getting started with SQL express from a c++ console application

Right now I am writing a little c++ console program using VS2010 Express. The next thing I want to do is to access a SQL database from within this program.
I've downloaded SQL server 2008 express. I've managed to set up a little db using the db gui.
My question now is, how do I access this db from within my program. Which header files do I need, how do I connect? About the basic tempering with the db itself I have found many tutorials, but this tiny bit that closes the gap between a program and the connection to the db drives me nuts... If any one has a nice tip to a tutorial or book, please let me know.
I've also tried to start a new project in VS, and was hoping to find some kind of setup wizard for a "sql project" that would get me one the way but did not find such a wiz...
Microsoft doesn't provide much for SQL connectivity from C++ console applications. There are a number of libraries such as SOCI and DTL that can help though.