> ## Documentation Index
> Fetch the complete documentation index at: https://projectdiscovery-subfinder-reference-blog.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Mssql

<a name="module_mssql" />

## mssql

* [mssql](#module_mssql)
  * [`MSSQLClient`](#module_mssql..MSSQLClient)
    * [`.Connect(host, port, username, password)`](#module_mssql..MSSQLClient+Connect) ⇒ <code>bool</code>
    * [`.ConnectWithDB(host, port, username, password, dbName)`](#module_mssql..MSSQLClient+ConnectWithDB) ⇒ <code>bool</code>
    * [`.IsMssql(host, port)`](#module_mssql..MSSQLClient+IsMssql) ⇒ <code>bool</code>

<a name="module_mssql..MSSQLClient" />

### (mssql).MSSQLClient

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

**Kind**: inner class of [<code>mssql</code>](#module_mssql)

* [`MSSQLClient`](#module_mssql..MSSQLClient)
  * [`.Connect(host, port, username, password)`](#module_mssql..MSSQLClient+Connect) ⇒ <code>bool</code>
  * [`.ConnectWithDB(host, port, username, password, dbName)`](#module_mssql..MSSQLClient+ConnectWithDB) ⇒ <code>bool</code>
  * [`.IsMssql(host, port)`](#module_mssql..MSSQLClient+IsMssql) ⇒ <code>bool</code>

<a name="module_mssql..MSSQLClient+Connect" />

#### mssqlClient.Connect(host, port, username, password) ⇒ <code>bool</code>

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 [<code>MSSQLClient</code>](#module_mssql..MSSQLClient)\
**Returns**: <code>bool</code> - - The status of the connection.\
**Throws**:

* <code>error</code> - The error encountered during connection.

| Param    | Type                | Description                                     |
| -------- | ------------------- | ----------------------------------------------- |
| host     | <code>string</code> | The host of the MS SQL database.                |
| port     | <code>int</code>    | The port of the MS SQL database.                |
| username | <code>string</code> | The username to connect to the MS SQL database. |
| password | <code>string</code> | The password to connect to the MS SQL database. |

**Example**

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

<a name="module_mssql..MSSQLClient+ConnectWithDB" />

#### mssqlClient.ConnectWithDB(host, port, username, password, dbName) ⇒ <code>bool</code>

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 [<code>MSSQLClient</code>](#module_mssql..MSSQLClient)\
**Returns**: <code>bool</code> - - The status of the connection.\
**Throws**:

* <code>error</code> - The error encountered during connection.

| Param    | Type                | Description                                     |
| -------- | ------------------- | ----------------------------------------------- |
| host     | <code>string</code> | The host of the MS SQL database.                |
| port     | <code>int</code>    | The port of the MS SQL database.                |
| username | <code>string</code> | The username to connect to the MS SQL database. |
| password | <code>string</code> | The password to connect to the MS SQL database. |
| dbName   | <code>string</code> | The name of the database to connect to.         |

**Example**

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

<a name="module_mssql..MSSQLClient+IsMssql" />

#### mssqlClient.IsMssql(host, port) ⇒ <code>bool</code>

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 [<code>MSSQLClient</code>](#module_mssql..MSSQLClient)\
**Returns**: <code>bool</code> - - The status of the check.\
**Throws**:

* <code>error</code> - The error encountered during the check.

| Param | Type                | Description        |
| ----- | ------------------- | ------------------ |
| host  | <code>string</code> | The host to check. |
| port  | <code>int</code>    | The port to check. |

**Example**

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