Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
1.0.1
-
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({
,
,
,
{"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)
// Exit (Success)
return 0;
}??
I meet this error for 32 and 64 bits