Release Notes for MariaDB Connector/C++ 1.1.1

Overview

MariaDB Connector/C++ is the interface between C++ applications and MariaDB Server. MariaDB Connector/C++ enables development of C++ applications using a JDBC-based API, which is also used by MariaDB Connector/J. This is the second Beta release of MariaDB Connector/C++.

MariaDB Connector/C++ 1.1.1 was released on 2022-03-04. This release is of Beta maturity, and should not be used with production workloads.

MariaDB Connector/C++ in its current implementation uses the MariaDB protocol via the MariaDB Connector/C API. Connector/C 3.3.0 is used in this release.

Notable Changes

  • MariaDB Connector/C++ 1.1.1 adds the ability to create a connection pool to improve usage of resources and to provide a faster way to connect to the server. (CONCPP-2)

    • The new class MariaDbDataSource has been added to enable creating a connection pool. The pool is created when MariaDbDataSource::getConnection is called the first time.

      Example:

      sql::mariadb::MariaDbDataSource ds("jdbc:mariadb://localhost:3306/db?minPoolSize=2&maxPoolSize=8&maxIdleTime=900&poolValidMinDelay=2000");
      ds.setUser("root");
      ds.setPassword("myPassword");
      
      // connect to server using the credentials from the pool
      std::unique_ptr<sql::Connection> conn1(ds.getConnection());
      std::unique_ptr<sql::Connection> conn2(ds.getConnection());
      
    • New connection properties have been added to configure the pool:

      Property

      Description

      minPoolSize

      The minimum number of connections to be kept in the pool (defaults to maxPoolSize value)

      maxPoolSize

      The maximum number of physical connections that the pool can contain (defaults to 8)

      maxIdleTime

      The maximum amount of time in seconds that connections above minPoolSize can stay in the pool if not used. This value must always be at least 45 seconds lower than the @wait_timeout value.
      Default: 600 in seconds(=10 minutes), minimum value is 60 seconds

      poolValidMinDelay

      The period of time in milliseconds after returning a connection to the pool, during which the connection is considered to be good and does not require validation on return to the application. 0 means validation is done each time the connection is requested (defaults to 1000)

    • Default for option useResetConnection has been changed from false to true. The change of default to true means the Connection::reset() method issues a connection reset command at the server by default. Previous default value of false meant Connection::reset() did a "soft reset" and set only certain system variables and connection parameters according to the connection properties.

  • New node failover support. (CONCPP-4)

    An application can supply more than one host to use for connection. An individual port number can be specified for each host:

    sql::SQLString
    failoverUrl("jdbc:mariadb:sequential://localhost:3306,failoverhost1.com,[::1]:3307,failoverhost2.com:3307/db?user=root&password=someSecretWord");
    std::unique_ptr<Connection> conn(DriverManager::getConnection(failoverUrl));
    

    MariaDB Connector/C++ 1.1 will always try to connect to the first host in the list. Other hosts in the list will be used if a tried host cannot be reached.

  • LOAD DATA LOCAL INFILE is not allowed by default. It can be switched on by using the allowLocalInfile property. (CONCPP-93, CONCPP-94)