Uploaded image for project: 'MariaDB Connector/C++'
  1. MariaDB Connector/C++
  2. CONCPP-100

Exception thrown inside sql::Driver->connect

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • 1.0.1
    • N/A
    • General
    • None
    • Windows 10
      Visual Studio 2019

    Description

      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;
      }??

      I meet this error for 32 and 64 bits

      Attachments

        Activity

          Thank you for your report. Is it like you are building your test program as Debug and link against our release binaries? Then that is a known issue, that is solved in 1.1 branch(not stable yet). Workarounds could be either building Release/RelWithDebInfo or building own connector binaries from source code.

          Lawrin Lawrin Novitsky added a comment - Thank you for your report. Is it like you are building your test program as Debug and link against our release binaries? Then that is a known issue, that is solved in 1.1 branch(not stable yet). Workarounds could be either building Release/RelWithDebInfo or building own connector binaries from source code.

          I'm closing it since you have not answered so far, and I'm almost sure it's the known issue, that we won't fix in the 1.0, and it is fixed in 1.1
          You can always re-open it if you think it's different from what I described in my previous comment

          Lawrin Lawrin Novitsky added a comment - I'm closing it since you have not answered so far, and I'm almost sure it's the known issue, that we won't fix in the 1.0, and it is fixed in 1.1 You can always re-open it if you think it's different from what I described in my previous comment
          alternatif leo Cluzel added a comment -

          Sorry for the late response, after testing you were right, it works when building in Release mode.

          alternatif leo Cluzel added a comment - Sorry for the late response, after testing you were right, it works when building in Release mode.

          People

            Lawrin Lawrin Novitsky
            alternatif leo Cluzel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.