MariaDB Connector/C++ for Win64 v1.0.1 throws exception

I am trying to connect to my MariaDB instance through C++ code. Here is the code which I got from here (obviously changed the ip and credentials) : https://mariadb.com/docs/clients/mariadb-connectors/connector-cpp/connect/#connector-cpp-connection-methods-driver

It throws the following exception at the "Establish Connection":

Exception thrown: read access violation. other.theString._Mypair._Myval2 was 0xFFFFFFFFFFFFFFEF.

// Includes
#include <iostream>
#include <mariadb/conncpp.hpp>

// Main Process
int main(int argc, char **argv)
{
   try
   {
      // Instantiate Driver
      sql::Driver* driver = sql::mariadb::get_driver_instance();

      // Configure Connection
      // The URL or TCP connection string format is
      // ``jdbc:mariadb://host:port/database``.
      sql::SQLString url("jdbc:mariadb://192.0.2.1:3306/test");

      // Use a properties map for the user name and password
      //The ``useTls`` option enables TLS
      //The ``tlsCA`` option specifies path to a PEM file that contains a X509 certificate for trusted Certificate Authorities (CAs).
      sql::Properties properties({
            {"user", "db_user"},
            {"password", "db_user_password"},
            {"useTls", "true"},
            {"tlsCA", "tls-ca-root.pem"}
         });

      // Establish Connection
      // Use a smart pointer for extra safety
      std::unique_ptr<sql::Connection> conn(driver->connect(url, properties));

      // Use Connection
      // ...

      // Close Connection
      conn->close();
   }

   // Catch Exceptions
   catch (sql::SQLException& e)
   {
      std::cerr << "Error Connecting to MariaDB Platform: "
         << e.what() << std::endl;

      // Exit (Failed)
      return 1;
   }

   // Exit (Success)
   return 0;
}

Then I changed the url to this:

      sql::SQLString url("jdbc:mariadb://192.0.2.1:3306/test?useTls=true&tlsCA=tls-ca-root.pem");

      sql::Properties properties({
            {"user", "db_user"},
            {"password", "db_user_password"},
         });

This time I am getting a different exception.

Exception thrown at 0x00007FFF7683D55E (mariadbcpp.dll) in ms33.exe: 0xC0000005: Access violation reading location 0x0000000000000019.

Has anyone got this connector working? Any help is much appreciated.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.