Too Many Connections
MySQL, by default, only allows 151 connections (plus one more for a super user).

In your MATLAB output, you show 149 then 150 threads.  I presume that the majority of those are connecting to the database.  150 MATLAB threads will generate 150 connections.

There are few ways you could try to fix this.


One possibility is to limit the number of threads in MATLAB.  You can do that using the maxNumberCompThreads function.  Note that this is only available in R2007b through R2010a (and it will give you warning as of R2009b).  Alternatively, the -singleCompThread option will work as well, but limits you to one thread.
Try to limit the time that you have a connection open to the absolute shortest interval possible:  Open the connection, process the database work, close the connection.  This may work, depending upon how much other (non-database) work each thread is doing.
Finally, you could increase the number of connections allowed to the database.  You will need to change the max_connections server option.  Just use the command  "SET MAX_CONNECTIONS = 500".