PDO Database Connections Problem?

PDOStatement::closeCursor() frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a state that enables it to be executed again In other words, it was closing your connection on you That still doesn't explain why it got through 1200 records before the problem occurred, though.

PDOStatement::closeCursor() frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a state that enables it to be executed again. In other words, it was closing your connection on you. That still doesn't explain why it got through 1200 records before the problem occurred, though.

Thanks for the response R. Yeah it is very strange also that I have been using these queries almost exactly like these ones in all of my other programs with no problems. I also figured that if I am creating new objects each time that the closeCursor should only close the sth in the current object.Do you think I should just leave it out?

Or is it better if I find a way to work it in? – Metropolis May 28 '10 at 19:54 @Metropolis: Sorry about not replying sooner. The cursor should automatically be closed when the PDOStatement goes out of memory, so you should be OK leaving it off.

– Powerlord Jun 28 '10 at 17:02 Cool thanks for the reply R :) – Metropolis Jun 28 '10 at 18:30.

Over a year ago I created my own database classes which use PDO, and handle all preparing, executing, and closing connections. These classes have been working great up until now. There are two different database severs I am grabbing from, MySQL, and MS SQL Express.

I am retrieving an employee id from the MySQL server and using it to get that employees information from the MS SQL server. There are about 11k records coming from the MySQL server and my program is only making it through 1200 before crashing with an error like the following. It seems like the program is not able to connect to the data source, but it is running the exact same query about 30 times before this and having no problem.

Also, I have thoroughly checked all of the data coming into the query and it all looks fine. I believe the issue may be that there are to many connections being created, but I have tried to close all connections in many different places, and nothing seems to be fixing the problem. Any debugging help, or suggestions would be appreciated!

Ok, I found the problem, I was using closeCursor after preparing the query, and before the execute. I took out the closeCursor and it seems to have fixed this problem.... BUT WHY? That does not make any sense to me.....

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions