You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+101Lines changed: 101 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,4 +146,105 @@ You need to configure the parameters:
146
146
### The results
147
147
- For every interaction the results will be save on **c:\test\ResultsN.Log**, where **N** is the number of job execute.
148
148
149
+
# SQLConnectivityTestMultiDriver.ps1
150
+
This application has been designed with a main idea: We usually have service requests when our customers, using different drivers, need to know the connection latency, execution time spent or validate the connection.
151
+
For this reason, I developed this small PowerShell script (based on initiative of AzureSQLConnectivityChecker in multiple languages) which will basically connect to the database using 4 drivers/providers and test this.
152
+
153
+
## Today, we started with SQLConnectivityTestMultiDriver.ps1 PowerShell Script and you are going to be able to:
154
+
155
+
-**Connect using the drivers**: Net SqlClient, ODBC 17, OLEDB and MSOLEDBSQL.
156
+
-**In every interaction**, you could obtain:
157
+
++ Connectivity latency.
158
+
++ Time invested in the execution of each query.
159
+
++ Average time spent on connectivity and per query.
160
+
++ How many ports the customer application has (1433,11000-12000 and others).
161
+
++ Check if the DNS is resolving correct IP.
162
+
163
+
## Here are the main details:
164
+
165
+
-**Parameters**, if you don't specify any of them, PowerShell Script will ask the value and check it.
166
+
167
+
+**$DatabaseServer**, will be the server name to connect.
168
+
+**$Database**, will be the database name to connect.
169
+
+**$Username**, user name to connect
170
+
+**$passwordSecure**, password.
171
+
+**$NumberExecutions**, how many executions that you want to run.
172
+
+**$LogFile**, will be the log file that all operations will be saved. If this file is not specify, the application will ask the location.
173
+
+**$Driver** to use, the values are:
174
+
++ SQLCLIENT for .NET SQL Client.
175
+
++ ODBC
176
+
++ MSOLEDBSQL
177
+
++ SQLOLEDB
178
+
+ $InputFile**, will be the different TSQL that you want to use. This file needs to contain per line the TSQL to execute. If you don't specify it, we are going to use SELECT 1. For example,:
179
+
SELECT 1
180
+
SELECT count(Id) FROM PerformanceVarcharnVarchar Where TextToSearch = N'Test Search ' + CONVERT(nvarchar(200),RAND()*(2000000-10000)+10000) OPTION (MAXDOP 1)
181
+
182
+
## Outcome:
183
+
In the $LogFile you are going to have all the results and summary about connection and execution spent, for example,
184
+
185
+
2022-08-11 03:33:15 Driver: SQLOLEDB
186
+
2022-08-11 03:33:15 Connecting to the database: servername.database.windows.net - DB: dbname...Attempt #1 of 5 - IP:52.138.224.1
187
+
2022-08-11 03:33:16 Connected to the database in (ms):324.1887 - Provider:SQLOLEDB -- HostName: Server Version:12.00.0312
echo"Missing sqlcmd command to test connectivity for SQL databases, please refer to: https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-ver16"
0 commit comments