Class: DbConfiguration

DbConfiguration

Database Settings container.

Constructor

new DbConfiguration(host, port, name, user, password, dbms)

Build a DbConfiguration which can be sent to/by the remote device to be applied.
Parameters:
Name Type Description
host string IP address of the server hosting the database management system.
port number TCP port number (by default, MySQL: 3306, PostgreSQL: 5432, SQL Server: 1433).
name string Database name.
user string Authorized (read and write) user's name.
password string Authorized (read and write) user's password. Can be null or blank.
dbms string Database Management System (see constants: MySQL, PostgreSQL or SQL_Server).
Throws:
If an invalid parameter is given.
Type
SyntaxError

Members

(static) MySQL :string

MySQL constant, used to get and set the DBMS of a DbConfiguration instance.
Type:
  • string

(static) PostgreSQL :string

MySQL constant, used to get and set the DBMS of a DbConfiguration instance.
Type:
  • string

(static) SQL_Server :string

MySQL constant, used to get and set the DBMS of a DbConfiguration instance.
Type:
  • string

Methods

getDbms() → {string}

Returns:
DBMS powering the database. Constant value: MySQL or PostgreSQL or SQL_Server.
Type
string

getHost() → {string}

Returns:
IP address of the server running the DBMS.
Type
string

getName() → {string}

Returns:
Name of the database.
Type
string

getPassword() → {string}

Returns:
Password of the user allowed to read and write in the database.
Type
string

getPort() → {number}

Returns:
TCP port number used by the DBMS.
Type
number

getUser() → {string}

Returns:
Name of the user allowed to read and write in the database.
Type
string

setDbms(dbms)

Update the type of Database Management System powering the database.
Parameters:
Name Type Description
dbms string New DBMS (must be one of the available constant: MySQL, PostgreSQL or SQL_Server).
Throws:
In case of invalid parameter.
Type
SyntaxError

setHost(host)

Update the IP address of the host.
Parameters:
Name Type Description
host string Server running the DBMS.
Throws:
In case of invalid parameter.
Type
SyntaxError

setName(name)

Update the name of the database used by the remote device.
Parameters:
Name Type Description
name string Name of the database to be used.
Throws:
In case of invalid parameter.
Type
SyntaxError

setPassword(password)

Update the password of the user allowed to read and write in the database.
Parameters:
Name Type Description
password string New password (null is equivalent to empty).

setPort(port)

Update the TCP port the DBMS is listening to.
Parameters:
Name Type Description
port number Server running the DBMS.
Throws:
In case of invalid parameter.
Type
SyntaxError

setUser(username)

Update the name of the user allowed to read and write in the database.
Parameters:
Name Type Description
username string New username.
Throws:
In case of invalid parameter.
Type
SyntaxError