Adding Oracle connection checking.
This commit is contained in:
parent
70b809e4f7
commit
832f8b3aa8
|
@ -8,6 +8,7 @@ import {
|
|||
Table,
|
||||
DatasourcePlus,
|
||||
DatasourceFeature,
|
||||
ConnectionInfo,
|
||||
} from "@budibase/types"
|
||||
import {
|
||||
buildExternalTableId,
|
||||
|
@ -21,7 +22,7 @@ import { FieldTypes } from "../constants"
|
|||
import {
|
||||
BindParameters,
|
||||
Connection,
|
||||
ConnectionAttributes,
|
||||
ConnectionAttributes, DBError,
|
||||
ExecuteOptions,
|
||||
Result,
|
||||
} from "oracledb"
|
||||
|
@ -49,7 +50,7 @@ const SCHEMA: Integration = {
|
|||
type: "Relational",
|
||||
description:
|
||||
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
||||
features: [],
|
||||
features: [DatasourceFeature.CONNECTION_CHECKING],
|
||||
datasource: {
|
||||
host: {
|
||||
type: DatasourceFieldType.STRING,
|
||||
|
@ -322,6 +323,29 @@ class OracleIntegration extends Sql implements DatasourcePlus {
|
|||
this.schemaErrors = final.errors
|
||||
}
|
||||
|
||||
async testConnection() {
|
||||
const response: ConnectionInfo = {
|
||||
connected: false,
|
||||
}
|
||||
let connection
|
||||
try {
|
||||
connection = await this.getConnection()
|
||||
} catch (err: any) {
|
||||
response.connected = false
|
||||
response.error = err.message
|
||||
} finally {
|
||||
if (connection) {
|
||||
try {
|
||||
await connection.close()
|
||||
} catch (err: any) {
|
||||
response.connected = false
|
||||
response.error = err.message
|
||||
}
|
||||
}
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
private async internalQuery<T>(query: SqlQuery): Promise<Result<T>> {
|
||||
let connection
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue