Connecting MySql to C++ Project via wxWidgets

In this forum you can discuss database related issues which can be wxWidgets related, but also generic in nature.
Post Reply
User avatar
Inspired Child
In need of some credit
In need of some credit
Posts: 3
Joined: Wed Dec 24, 2014 6:45 pm

Connecting MySql to C++ Project via wxWidgets

Post by Inspired Child » Wed Dec 24, 2014 6:53 pm

Hi everyone!

I am new to this forum! I will be developing a desktop application soon via wxWidgets but I've been doing a lot of online research prior to the development. Primarily, I want to know how to connect MySql with wxWidgets. I want to use MySql and not the built-in DB. After setting up Codeblocks and wxWidget, how do I connect MySql to the project I'm working on? What I mean is how do I get MySql to be the database on which the application is built?

Grateful for your replies! :P

User avatar
doublemax
Moderator
Moderator
Posts: 13427
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Connecting MySql to C++ Project via wxWidgets

Post by doublemax » Thu Dec 25, 2014 2:20 am

I want to use MySql and not the built-in DB.
What do you mean with "built-in DB"? wxWidgets has not DB built in.

In general wxWidgets has no database support, you'll need external components for that. There is "wxDatabaseLayer", but it hasn't seen any recent development.

But don't really need a wxWidgets specific component, you could just use any C++ wrapper for MySQL, e.g. MySQL++
http://tangentsoft.net/mysql++/
Use the source, Luke!

User avatar
Inspired Child
In need of some credit
In need of some credit
Posts: 3
Joined: Wed Dec 24, 2014 6:45 pm

Re: Connecting MySql to C++ Project via wxWidgets

Post by Inspired Child » Thu Dec 25, 2014 3:43 pm

Thanks for the link and response (I'll definitely read it) but please bear with me as I am also new-ish to programming as well. MySQL++ is a sub-platform of MySQL? What I mean is, does it operate just like MySQL but is more flexible with wxWidgets? If I use it when building my app, will it be the underlying database that my app will be built on? I understand what you said about wxWidgets not having a built-in DB. can I connect to MySQL++ and use it as the database? I don't understand the whole "c++ wrapper" concept that's why I'm seeking explicit explanation. I don't know what a "wrapper" is. I've read a whole lot of online material about wxWidgets and c++ but never came across "wrapper".

I hope you understand what it is I'm trying to say/ask.

User avatar
doublemax
Moderator
Moderator
Posts: 13427
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Connecting MySql to C++ Project via wxWidgets

Post by doublemax » Thu Dec 25, 2014 3:55 pm

The basic library to connect to an MySQL database usually has a C interface which looks like this:
http://dev.mysql.com/doc/refman/5.7/en/ ... rview.html

A C++ wrapper is just a set of C++ classes that sits on top of this C interface and makes it easier to use, especially since wxWidgets is a C++ library, too.
Use the source, Luke!

User avatar
Inspired Child
In need of some credit
In need of some credit
Posts: 3
Joined: Wed Dec 24, 2014 6:45 pm

Re: Connecting MySql to C++ Project via wxWidgets

Post by Inspired Child » Thu Dec 25, 2014 4:19 pm

Double Max,

Thanks. I'll read the materials you gave me. Thanks for replying. If I have any more questions, I will ask.

Regards,
Inspired Child

steph291
In need of some credit
In need of some credit
Posts: 3
Joined: Wed May 15, 2019 12:02 pm

Re: Connecting MySql to C++ Project via wxWidgets

Post by steph291 » Wed May 15, 2019 3:57 pm

I'm used to api's like OCI Oracle Call Interface,
dblib for mssql or mysql libmysqlclient-dev... all in C.
I'm pretty sure you could implement .h
and libs easily in a wxSmith project
tweak the stuff and go, try it with c calls!
:?:

steph291
In need of some credit
In need of some credit
Posts: 3
Joined: Wed May 15, 2019 12:02 pm

Re: Connecting MySql to C++ Project via wxWidgets

Post by steph291 » Fri May 24, 2019 9:40 pm

I'll do that this weekend !
Implement mysql calls to libmysqlclient-dev
in a GUI wxWidgets apps.

Env. : Linux Ubuntu Bionic 64b, Win7 64b
IDE : Code::Blocks
RAD : wxSmith
Comm. : tcp/ip internal network addr. range 192.168.x.x

Machine 1: win7 with mobaxterm
ssh terminal tunnelling
Machine 2 : Ubuntu Bionic having Code::Blocks
DISPLAY redirected to machine 1
Machine 3 : Ubuntu Bionic having Mysql Database engine

Busy, busy :wink:

Post Reply