Lesson Learned #154: JAVA Console Script for Testing connection in Azure SQL

Published Dec 11 2020 11:38 AM 943 Views

To connect to Azure SQL Database we could use multiple tools or coding languages like C#, PHP, Java, etc.. In some situations, we need to test our application, for example, how much time take a single connection, review my retry-logic, review the connection, etc.. 

 

In this URL you could find an example about several operations that you could use using JAVA. 

 

This application has been designed with a main idea: how to obtain information about the elapsed time in the connectivity process and the query execution to a database of Azure SQL Database using JAVA (Microsoft JDBC Driver for SQL Server). This JAVA console script runs in Windows and Linux.

 

This JAVA console script has the main features:

  • Connect using Microsoft JDBC Driver for SQL Server measuring the time spent.
  • Once you have established the connection runs multiple times the query SELECT 1 measuring the time spent.

You could find the instrucctions in readme file.

 

As always, all feedback and contributions are very welcome.

 

Enjoy!

%3CLINGO-SUB%20id%3D%22lingo-sub-1980891%22%20slang%3D%22en-US%22%3ELesson%20Learned%20%23154%3A%20JAVA%20Console%20Script%20for%20Testing%20connection%20in%20Azure%20SQL%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1980891%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3ETo%20connect%20to%20Azure%20SQL%20Database%20we%20could%20use%20multiple%20tools%20or%20coding%20languages%20like%20C%23%2C%20PHP%2C%20Java%2C%20etc..%26nbsp%3BIn%20some%20situations%2C%20we%20need%20to%20test%20our%20application%2C%20for%20example%2C%20how%20much%20time%20take%20a%20single%20connection%2C%20review%20my%20retry-logic%2C%20review%20the%20connection%2C%20etc..%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJMNetwalker%2FAzureSQLConnectivityChecker%2Ftree%2Fmaster%2FJAVA%22%20target%3D%22_self%22%20rel%3D%22noreferrer%20noopener%22%3EURL%3C%2FA%3E%26nbsp%3Byou%20could%20find%20an%20example%20about%20several%20operations%20that%20you%20could%20use%20using%20JAVA.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20application%20has%20been%20designed%20with%20a%20main%20idea%3A%20how%20to%20obtain%20information%20about%20the%20elapsed%20time%20in%20the%20connectivity%20process%20and%20the%20query%20execution%20to%20a%20database%20of%20Azure%20SQL%20Database%20using%20JAVA%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Fjdbc%2Fmicrosoft-jdbc-driver-for-sql-server%3Fview%3Dsql-server-ver15%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20JDBC%20Driver%20for%20SQL%20Server%3C%2FA%3E).%20This%20JAVA%20console%20script%20runs%20in%20Windows%20and%20Linux.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20JAVA%20console%20script%20has%20the%20main%20features%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EConnect%20using%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fconnect%2Fjdbc%2Fmicrosoft-jdbc-driver-for-sql-server%3Fview%3Dsql-server-ver15%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20JDBC%20Driver%20for%20SQL%20Server%3C%2FA%3E%26nbsp%3Bmeasuring%20the%20time%20spent.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EOnce%20you%20have%20established%20the%20connection%20runs%20multiple%20times%20the%20query%20SELECT%201%20measuring%20the%20time%20spent.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20could%20find%20the%20instrucctions%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJMNetwalker%2FAzureSQLConnectivityChecker%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ereadme%20file.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20always%2C%20all%20feedback%20and%20contributions%20are%20very%20welcome.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EEnjoy!%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1980891%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3ETo%20connect%20to%20Azure%20SQL%20Database%20we%20could%20use%20multiple%20tools%20or%20coding%20languages%20like%20C%23%2C%20PHP%2C%20Java%2C%20etc..%26nbsp%3BIn%20some%20situations%2C%20we%20need%20to%20test%20our%20application%2C%20for%20example%2C%20how%20much%20time%20take%20a%20single%20connection%2C%20review%20my%20retry-logic%2C%20review%20the%20connection%2C%20etc..%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJMNetwalker%2FAzureSQLConnectivityChecker%2Ftree%2Fmaster%2FJAVA%22%20target%3D%22_self%22%20rel%3D%22noreferrer%20noopener%22%3EURL%3C%2FA%3E%26nbsp%3Byou%20could%20find%20an%20example%20about%20several%20operations%20that%20you%20could%20use%20using%20JAVA.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Version history
Last update:
‎Dec 11 2020 11:38 AM
Updated by: