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

Exception thrown inside sql::Driver->connect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0.1
    • Fix Version/s: N/A
    • Component/s: General
    • Labels:
      None
    • Environment:
      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

            People

            Assignee:
            Lawrin Lawrin Novitsky
            Reporter:
            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.