ExecSQL and Pooling
Posted: Tue 10 Jun 2014 09:23
Hello
I am testing UniDAC for importing data from text files into a DB table (currently MySQL). For this I parse the file line by line, build an INSERT statement and execute it with TUniConnection.ExecSQL('INSERT ...');
Depending on the file it is sometimes done in a large INSERT statement that contains a few hundred records/lines, or a separate INSERT statement for each record.
After a few thousand executions of ExecSQL I get this error:
"Lost connection to MySQL server during query
Error on data reading from the connection:
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
Socket Error Code: 10057($2749)"
I noticed that my app seems to open/close a new connection for each ExecSQL statement, so after a minute or so in the TCP monitoring tool I see several thousand connections to MySQL in the TIME_WAIT state.
Could this opening and closing ports be the reason for the error?
I connect to the DB explicitly with TUniConnection.Connected := true;
I also tried setting Pooling to true and limiting the pool size, but this seems to have no effect.
Is there anything specific I have to set to make TUniConnection keep the connection to the DB?
Forgot to mention that this is with UniDAC 5.3.8, Delphi XE4, MySQL 5.5.32 on Win7, Direct connection to the DB.
Thanks
Vladimir
I am testing UniDAC for importing data from text files into a DB table (currently MySQL). For this I parse the file line by line, build an INSERT statement and execute it with TUniConnection.ExecSQL('INSERT ...');
Depending on the file it is sometimes done in a large INSERT statement that contains a few hundred records/lines, or a separate INSERT statement for each record.
After a few thousand executions of ExecSQL I get this error:
"Lost connection to MySQL server during query
Error on data reading from the connection:
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
Socket Error Code: 10057($2749)"
I noticed that my app seems to open/close a new connection for each ExecSQL statement, so after a minute or so in the TCP monitoring tool I see several thousand connections to MySQL in the TIME_WAIT state.
Could this opening and closing ports be the reason for the error?
I connect to the DB explicitly with TUniConnection.Connected := true;
I also tried setting Pooling to true and limiting the pool size, but this seems to have no effect.
Is there anything specific I have to set to make TUniConnection keep the connection to the DB?
Forgot to mention that this is with UniDAC 5.3.8, Delphi XE4, MySQL 5.5.32 on Win7, Direct connection to the DB.
Thanks
Vladimir