MSSQL.specify_conn_str

MSSQL.specify_conn_str(database_name=None, auth=None, password=None)

Specify a string used for establishing a connection.

Parameters
  • database_name (str or None) – name of a database, defaults to the name of the currently-connected database when database=None

  • auth (str or None) – authentication method (used for establish the connection), defaults to the current authentication method when auth=None

  • password (str or int or None) – user’s password; when password=None (default), it is required to mannually type in the correct password to connect the PostgreSQL server

Returns

connection string

Return type

str

Examples:

>>> from pyhelpers.dbms import MSSQL

>>> mssql = MSSQL()
Connecting <server_name>@localhost:1433/master ... Successfully.

>>> conn_str = mssql.specify_conn_str()
>>> conn_str
'DRIVER={ODBC Driver 17 for SQL Server};SERVER={localhost};DATABASE={master};Trusted_...