mssql

(mssql).MSSQLClient

MSSQLClient is a client for MS SQL database. Internally client uses denisenkom/go-mssqldb driver.

Kind: inner class of mssql

mssqlClient.Connect(host, port, username, password) ⇒ bool

Connect connects to MS SQL database using given credentials. If connection is successful, it returns true. If connection is unsuccessful, it returns false and error. The connection is closed after the function returns.

Kind: instance method of MSSQLClient
Returns: bool - - The status of the connection.
Throws:

  • error - The error encountered during connection.
ParamTypeDescription
hoststringThe host of the MS SQL database.
portintThe port of the MS SQL database.
usernamestringThe username to connect to the MS SQL database.
passwordstringThe password to connect to the MS SQL database.

Example

let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isConnected = c.Connect('localhost', 1433, 'username', 'password');

mssqlClient.ConnectWithDB(host, port, username, password, dbName) ⇒ bool

ConnectWithDB connects to MS SQL database using given credentials and database name. If connection is successful, it returns true. If connection is unsuccessful, it returns false and error. The connection is closed after the function returns.

Kind: instance method of MSSQLClient
Returns: bool - - The status of the connection.
Throws:

  • error - The error encountered during connection.
ParamTypeDescription
hoststringThe host of the MS SQL database.
portintThe port of the MS SQL database.
usernamestringThe username to connect to the MS SQL database.
passwordstringThe password to connect to the MS SQL database.
dbNamestringThe name of the database to connect to.

Example

let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isConnected = c.ConnectWithDB('localhost', 1433, 'username', 'password', 'myDatabase');

mssqlClient.IsMssql(host, port) ⇒ bool

IsMssql checks if the given host is running MS SQL database. If the host is running MS SQL database, it returns true. If the host is not running MS SQL database, it returns false.

Kind: instance method of MSSQLClient
Returns: bool - - The status of the check.
Throws:

  • error - The error encountered during the check.
ParamTypeDescription
hoststringThe host to check.
portintThe port to check.

Example

let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isMssql = c.IsMssql('localhost', 1433);