mithrandyr / SimplySql

PowerShell module for querying various SQL databases
MIT License
197 stars 31 forks source link

can you set the ConnectionTimeout parameter for Open-MySQLConnection? #116

Closed comsyspro closed 1 year ago

comsyspro commented 1 year ago

can you set the ConnectionTimeout parameter for Open-MySQLConnection? i want to loop through some ips until a sql connection can be opened, but at the moment the connection timeout is at 15 seconds. i would like to lower it down to lets say 3 seconds. can you implement this setting please or do you know how to define this parameter in powershell? image

comsyspro commented 1 year ago

i found the solution:

C:\Program Files\WindowsPowerShell\Modules\SimplySql\1.9.1\Providers\MySql\config.ps1 insert after line 64: , [Parameter(ValueFromPipelineByPropertyName, ParameterSetName="default")][int]$ConnectionTimeout = 15 insert after line 94: If($ConnectionTimeout) { $sb.ConnectionTimeout = $ConnectionTimeout }

or you can also define -ConnectionString with parameter connectiontimeout=3