<p>Do any asynchronous connectors exist for Mysql that can be used within a C or C++ application? I'm looking for something that can be plugged into a <a href="http://en.wikipedia.org/wiki/Reactor_pattern" rel="noreferrer" title="reactor pattern">reactor pattern</a> written in <a href="http://www.boost.org/doc/libs/release/libs/asio/index.html" rel="noreferrer" title="Boost.Asio">Boost.Asio</a>.</p>

<p>[Edit:] Running a synchronous connector in threads is not an option.</p>

[{'answer_id': 38526, 'author': 'Skizz', 'author_id': 1898, 'author_profile': 'https://Stackoverflow.com/users/1898', 'pm_score': 0, 'selected': False, 'text': '<p>I think the only solution will be to create an asynchronous service that wraps a <a href="http://dev.mysql.com/downloads/connector/odbc/5.1.html" rel="nofollow noreferrer">standard connector</a>. You\'ll need to understand the ODBC APIs though.</p>\n'}, {'answer_id': 149326, 'author': 'Vlagged', 'author_id': 6727, 'author_profile': 'https://Stackoverflow.com/users/6727', 'pm_score': 2, 'selected': False, 'text': "<p>I had a similar problem with a very different technologies: Twisted python (reactor-based IO) and sqlAlchemy (??). While searching for a solution, I found about an sAsync project that simply created a separate thread for sqlAlchemy and then responded to requests.</p>\n\n<p>Given that ASIO is based on low level OS features (such as aio_read() or ReadFileEx() etc) and an OS-level reactor (or proactor, in Windows' case) I don't think you have another chance than emulating the 'asynchronousness' by similar means.</p>\n\n<blockquote>\n  <p>Running a synchronous connector in threads is not an option</p>\n</blockquote>\n\n<p>Think about it: the <code>libmysqlclient / mysqlclient.dll</code> you're using makes synchronous socket calls. The OS scheduler will correctly switch to another thread until the I/O is finished,  so what's the difference? (apart from the fact that you shouldn't make 2k threads for this..)</p>\n\n<p>Edit: mysql_real_connect() supports an UNIX socket parameter. You can supposedly read yourself from the mysql server port and write to that UNIX socket only using ASIO. Like a proxyfication.</p>\n"}, {'answer_id': 154045, 'author': 'dj2', 'author_id': 23850, 'author_profile': 'https://Stackoverflow.com/users/23850', 'pm_score': 0, 'selected': False, 'text': '<p>There is a project called DBSlayer that puts another layer in front of MySQL that you talk to through JSON. <a href="http://code.nytimes.com/projects/dbslayer" rel="nofollow noreferrer">http://code.nytimes.com/projects/dbslayer</a></p>\n'}, {'answer_id': 154137, 'author': 'slashmais', 'author_id': 15161, 'author_profile': 'https://Stackoverflow.com/users/15161', 'pm_score': 1, 'selected': False, 'text': "<p>[    <em>Running a synchronous connector in threads is not an option\nThink about it: the libmysqlclient / mysqlclient.dll you're using makes synchronous socket calls. The OS scheduler will correctly switch to another thread until the I/O is finished</em>]</p>\n\n<p>This is bugging me! - the 'another thread' could as easily be a second sync. connection to mysql, and should be handled by mysql just as it would another client altogether? My gutfeel is that it should work using multiple threads.</p>\n"}, {'answer_id': 184763, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://forums.mysql.com/read.php?45,183339,183339" rel="nofollow noreferrer">http://forums.mysql.com/read.php?45,183339,183339</a>\nenjoy</p>\n\n<p>Updated link to the original article showing how to do async mysql queries:</p>\n\n<p><a href="http://jan.kneschke.de/projects/mysql/async-mysql-queries-with-c-api/" rel="nofollow noreferrer">http://jan.kneschke.de/projects/mysql/async-mysql-queries-with-c-api/</a></p>\n'}, {'answer_id': 621534, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>MySQL Connector/C++ is a C++ implementation of JDBC 4.0 </p>\n\n<p>The reference customers who use MySQL Connector/C++ are:\n- OpenOffice - MySQL Workbench</p>\n\n<p>Learn more: <a href="http://forums.mysql.com/read.php?167,221298" rel="nofollow noreferrer">http://forums.mysql.com/read.php?167,221298</a></p>\n'}, {'answer_id': 6220944, 'author': 'lurscher', 'author_id': 170521, 'author_profile': 'https://Stackoverflow.com/users/170521', 'pm_score': 0, 'selected': False, 'text': '<p>have you considered using <a href="https://launchpad.net/drizzle" rel="nofollow">libdrizzle</a>? i have used only an old version, from when it was a  separate project from drizzle, and i tested the asynchronous query features, but i never did any actual benchmarks worth mentioning. </p>\n'}, {'answer_id': 66560184, 'author': 'anarthal', 'author_id': 11253574, 'author_profile': 'https://Stackoverflow.com/users/11253574', 'pm_score': 2, 'selected': True, 'text': '<p>I know this is an old question, but consider looking at the new Boost.Mysql library: <a href="https://anarthal.github.io/mysql/index.html" rel="nofollow noreferrer">https://anarthal.github.io/mysql/index.html</a></p>\n'}]
['https://Stackoverflow.com/questions/38447', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4059/']