0

If I have to download Connector would I also need to download it on any computer I want to use the C++ application on? I haven't started any code for the database part yet but I'm writing an application that reads data and I want to store that in a mysql database using C++.

Garvin
  • 925
  • 2
  • 11
  • 16
  • An SQlite database can be a good choice. It's small, fast and free - it also has the large benefit of not requiring installation - just statically link it or include the sqlite.dll file with your exe file and you're good to go - nothing stopping it run on a usb stick in any computer you throw it at. Using the ODBC route to whichever database you choose to use is well worth the effort - it then becomes entirely trivial to use the same data stored in any one of a bunh of different database engines - you often just need to change the connection string - something to consider, anyway. – enhzflep Mar 07 '14 at 04:26
  • I will look at that as it seems I would have to buy a GPL license which means I will need to open source my code as well and other implications (I think). – Garvin Mar 07 '14 at 15:46
  • Hmm. I'm no legal expert by any means, though I was under the impression that SQLite is released to the public domain and as such, you're more-or-less free to do with it as you please. The following quote from their site appears to agree: `Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original SQLite code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.` Source: https://sqlite.org/copyright.html - I'm don't think you even have to acknowledge its usage, let alone share source code. – enhzflep Mar 07 '14 at 16:15

1 Answers1

1

Is Using MySql Connector/C++ necessary in order to access/change mysql database?

You don't have to connect to the official MySQL connector. You can use ODBC or other custom connectors.

If I have to download Connector would I also need to download it on any computer I want to use the C++ application on?

It depends whether you link to the MySQL connector library statically or dynamically.

  • Linking statically is achieved by linking against the static MySQL connector library, usually named libmysqlcppconn-static.a (or .lib on windows), and will allow you to run your program on environments where the mysql connector is not installed.
  • Linking dynamically is achieved by linking against the dynamic MySQL connector library, usually named libmysqlcppconn.so (or .dll on windows, .dylib on macOS), and will require your program to run on environments where the mysql connector has been installed.

This question discusses the tradeoffs of static vs. dynamic linking in more details.

This questions discusses the licensing implications of using MysQL connector.

Community
  • 1
  • 1
Martin J.
  • 5,028
  • 4
  • 24
  • 41
  • My application needs to be usable on computers other than mine which is why I was asking. Thanks. – Garvin Mar 07 '14 at 03:32
  • So to use the Mysql connector in the first place I would have to open source my code and buy a GPL license, just to clarify? I'm a bit new to the licensing and what the implications are. I will definitely have a look at ODBC though and will probably use that instead. – Garvin Mar 07 '14 at 15:47