1st Have you tried to use internal pooling. i.e. just
sql("mysql:options=a;@pool_size=10")
It allows you not to deal with pool object on your own.Do you close or destroy sql connection after you use (it would return the connection to the pool)
Regarding your way of doing things have you tried to check with the debugger what exactly returns the error?Because it does not seems to be pooling related error. Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
From: Alexander Mack <a....@ev...>
To: cpp...@li...
Sent: Thursday, July 16, 2015 12:48 PM
Subject: [Cppcms-users] Connection errors while using connection pool in multithreading programms (beside cppcms)
Hello Artyom,
Hello Community,
I'm testing cppdb as db-interface for a "non-cppcms" program. At the start of the program, I'm creating a global cppdb pool using the following command:
// Create the pool
cppdb::pool::pointer my_pool = cppdb::pool::create("sqlite3:db=test.db");
After that, I'm starting some threads. Each thread is trying to create a cppdb::session using the following command and doing some commands on the db:
// Use the pool
cppdb::session sql(my_pool->open());
sql.once(...); // doing some config
sql << ... // using session / doing some stuff on db..
If I'm "deactivating" the multithreading it works fine (I'm join()ing the threads directly after creating them).
As soon as I'm trying to run more than one thread at the same time, only the first thread works fine.. Each following thread throws a "cppdb::mysql::Can't connect to MySQL server on 'localhost' (111)" exceptions.
I already checked my mysql settings (e.g. max connections) and they are set on 500.
Has someone of you tried to do the same and got the same issues?
I'm happy about every hint :-)
Thank you very much,
Alex
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Cppcms-users mailing list
Cpp...@li...
https://lists.sourceforge.net/lists/listinfo/cppcms-users
|