0

Pretty confused here. Running a mysql query from Powershell using the Mysql connector. It is timing out after 41 seconds every time. Here is my connection string:

server=mysqlserver;port=3406;uid=admin;pwd=admin;database=MyDatabase;Connection Timeout=120

I even have the script spitting out the timeout using $Connection_cld.ConnectionTimeout, and it verifies it is 120 seconds.

However the query still always times out at 41 seconds, as per wrapping the command in Measure-Command. Such an odd number to be timing out, but I can't get past it.

[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data")
$Connection_cld = New-Object MySql.Data.MySqlClient.MySqlConnection
$Connection_cld.ConnectionString = $CloudDB_string
$Connection_cld.Open()
$Connection_cld.ConnectionTimeout
$Command_cld = New-Object MySql.Data.MySqlClient.MySqlCommand($Query_cld, $Connection_cld)
$DataAdapter_cld = New-Object MySql.Data.MySqlClient.MySqlDataAdapter($Command_cld)
$DataSet_cld = New-Object System.Data.DataSet
$time = (measure-command {$RecordCount_cld = $dataAdapter_cld.Fill($DataSet_cld, "data")}).totalseconds

Anyone have any ideas?

cbaum
  • 65
  • 1
  • 4
  • ConnectionTimeout is the timeout value for establishing a connection to MySQL, it won't change the query timeout. Looking for the right one now, but you could try CommandTimeout or QueryTimeout. – Gareth Lyons Mar 03 '17 at 14:54
  • Where would I set QueryTimeout? In the connection string as well? I can't find any docs on that. – cbaum Mar 03 '17 at 15:00
  • If that the answer in the dupe does not help explain why and we can open this again. – Matt Mar 03 '17 at 15:17

0 Answers0