Interface DbClient
This object provides access to methods that allow executing queries on ad-hoc databases. The database driver .jar must be added in the class path of the HTML Service under WEB-INF/lib
In order to initialize this object, the database driver type must be provided:
var db = new DbClient("sqljdbc42.jar");
Methods list
Methods
connect(dbUrl, dbUser, dbPass)
Initializes a connection to the provided database url. This method is required to be called before attempting to execute a query.
Declaration
connect(dbUrl: string, dbUser: string, dbPass: string): Promise<void>;
Parameters
| Type | Name | Description |
|---|---|---|
| string | dbUrl | |
| string | dbUser | |
| string | dbPass |
Returns
| Type | Description |
|---|---|
| Promise<void> |
query(sql)
Executes the provided sql query. The query must be complete and cannot be parameterizable. The executed query results are returned as a table.
Declaration
query(sql: string): Promise<Array<Array<any>>>;
Parameters
| Type | Name | Description |
|---|---|---|
| string | sql |
Returns
| Type | Description |
|---|---|
| Promise<Array<Array<any>>> |