1

I'm trying to use the mySQL c++ connector library (X DEV API) to communicate with a mySQL database.

I thought the mySQL structure were something like this:

Database -> Table -> Data

but in the c++ connector user guide they talk about accessing collections. Does anyone know what these collections are? Are they another way of storing data instead of in a table?

Link to the c++ connector user guide

eirikaso
  • 123
  • 15
  • 1
    Link 1 https://dev.mysql.com/doc/refman/8.0/en/mysql-shell-tutorial-javascript-documents-collections.html Link 2 https://dev.mysql.com/doc/refman/8.0/en/mysql-shell-tutorial-python-collections-operations.html – yusuf hayırsever Oct 31 '18 at 11:01

2 Answers2

2

The X DevAPI is not the same as the traditional connector. You are (probably) looking for the Connector/C++ manual.

It's a bit unfortunate that they are listed first on the connector site, but the X DevAPI is used to support a specific feature, using MySQL as a Document Store (aka "NoSQL"). In NoSQL, you indeed have collections, but unless you explicitly want to use a document store, this is the wrong api for you.

Solarflare
  • 10,721
  • 2
  • 18
  • 35
  • Thank you for the answer. Should I use the "Connector/C++ 1.1" version instead of the "Connector/C++ 8.0" version? – eirikaso Oct 31 '18 at 12:05
  • 1
    The 8.0 connector supports both apis, and it's generally recommended to use the actual 8.0 connector (the binary) even if you do not use the x devapi. The 1.1 manual should provide you with the subset of methods to use (for the jdbc, which is the old api). Just for completeness: you *can* use tables in x devapi too (see e.g. [here](https://dev.mysql.com/doc/x-devapi-userguide/en/devapi-users-working-with-relational-tables.html)). I do not want to guide you away from this if you want to do this, but I'd assume that most samples you find will use the connector as described in the 1.1 subset. – Solarflare Oct 31 '18 at 13:23
  • Thank you. Yes I found the table method in x dev api as well. I will just try and see which method is best for me – eirikaso Nov 01 '18 at 08:20
1

The X DevAPI lets you use MySQL as a NoSQL JSON Document Store where you do go schema->collection->JSON-document or as a traditional SQL database where you go schema->table ->data.

And yes you can combine collections and table.

Dave Stokes
  • 775
  • 4
  • 10