The MySQL driver sent the same queries 'USE database' before each query. This was prevented with static variable.