Does there exist any asynchronous connectors to Mysql that can be used in C or C++? I'm looking for something that can be plugged into a reactor pattern written in Boost.Asio.
[Edit:] Running a synchronous connector in threads is not an option.
Does there exist any asynchronous connectors to Mysql that can be used in C or C++? I'm looking for something that can be plugged into a reactor pattern written in Boost.Asio.
[Edit:] Running a synchronous connector in threads is not an option.
I think the only solution will be to create an asynchronous service that wraps a standard connector. You'll need to understand the ODBC APIs though.
Skizz
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.
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.
Running a synchronous connector in threads is not an option
Think 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, so what's the difference? (apart from the fact that you shouldn't make 2k threads for this..)
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.
There is a project called DBSlayer that puts another layer in front of MySQL that you talk to through JSON. http://code.nytimes.com/projects/dbslayer
[ Running a synchronous connector in threads is not an option Think 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]
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.
MySQL Connector/C++ is a C++ implementation of JDBC 4.0
The reference customers who use MySQL Connector/C++ are: - OpenOffice - MySQL Workbench
Learn more: http://forums.mysql.com/read.php?167,221298