Methods
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.
Parameters:
Name | Type | Description |
---|---|---|
host | string | The host of the MS SQL database. |
port | int | The port of the MS SQL database. |
username | string | The username to connect to the MS SQL database. |
password | string | The password to connect to the MS SQL database. |
- Source
Throws:
- - The error encountered during connection.
- Type
- error
Returns:
- The status of the connection.
- Type:
- bool
Example
let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isConnected = c.Connect('localhost', 1433, 'username', 'password');
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.
Parameters:
Name | Type | Description |
---|---|---|
host | string | The host of the MS SQL database. |
port | int | The port of the MS SQL database. |
username | string | The username to connect to the MS SQL database. |
password | string | The password to connect to the MS SQL database. |
dbName | string | The name of the database to connect to. |
- Source
Throws:
- - The error encountered during connection.
- Type
- error
Returns:
- The status of the connection.
- Type:
- bool
Example
let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isConnected = c.ConnectWithDB('localhost', 1433, 'username', 'password', 'myDatabase');
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.
Parameters:
Name | Type | Description |
---|---|---|
host | string | The host to check. |
port | int | The port to check. |
- Source
Throws:
- - The error encountered during the check.
- Type
- error
Returns:
- The status of the check.
- Type:
- bool
Example
let m = require('nuclei/mssql');
let c = m.MSSQLClient();
let isMssql = c.IsMssql('localhost', 1433);