Javascript Code To Check The Connection Between Orchestrator Server And Database, Also To Check The Execution Time Of Any Query

How to check connection and execution time of any query from Orchestrator server to database?

The below ready-made javascript code can be run in console tab of any browser from orchestrator server to check the connection between orchestrator and database server and execution time of any query from orchestrator server to database.

  • The connection time can be checked by using ODBC connection also. However, the advantage in using this method is the measuring the execution duration of any query from orchestrator server to database server(it may differ if we directly run some query in database as the connection takes some time to be established)
var d = new Date();
var n = d.getTime();
var objConnection = new ActiveXObject("adodb.connection");
var strConn = "driver={sql server};server=Servername;database=DatabaseName;uid=Username;password=Password";
var rs = new ActiveXObject("ADODB.Recordset");
var strQuery = "SELECT * FROM Logs";
rs.Open(strQuery, objConnection);
while (!rs.EOF) {
document.write(rs.fields(0) + "        ");
document.write(rs.fields(1) + "        ");
document.write(rs.fields(2) + "         ");
document.write(rs.fields(3) + "         ");
document.write(rs.fields(4) + "
var exetime = d.getTime();
var diff = exetime - n;

  • ActiveXObject is supported only in internet explorer. Hence this code will work only in internet explorer.
  • Provide the database details in the code - server name, database name, username and password.
  • The query used in the code can be modified as per the requirement.

Refer the below screenshot: