Skip to content

Efficient C++11 MySQL Connection Pool for real-time data and multi-threaded application

Notifications You must be signed in to change notification settings

domGitDev/sqlpoolcpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MYSQL CONNECTION POOL FOR REALTIME DATA

AUTHOR: DOM SILVA

COPYRIGHT: ENCE20 Inc.

WEBSITE: https://ence20.com

ARCHITECTURE

Install Dependencies CentOS

  • yum -y install mysql-community-libs mysql-devel

INCLUDE IN PROJECT

#include "./sqlconn/ConnectionPool.h"

std::string host = "127.0.0.1";
std::string username = "root";
std::string password = "password";
std::string database = "mydb";
size_t NUM_CONNS = 3;

std::shared_ptr<ConnectionPool> connPool;
connPool.reset(new ConnectionPool(
                host, port, username, password, database, NUM_CONNS));

// get connection
auto sqlPtr = connPool->GetConnecion();

// Use connection



// release connection
connPool->ReleaseConnecion(sqlPtr);

RUN EXAMPLE

  • update database credentials by editing config.txt

  • on command line run:

cd example

./compile.sh

./multiConn
  • press Ctrl+C to exit

About

Efficient C++11 MySQL Connection Pool for real-time data and multi-threaded application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published