【发布时间】:2021-04-25 17:42:21
【问题描述】:
我有需要运行的脚本,确切地说是CREATE TABLE 脚本。
我有这样的功能,见下文:
oracleLoader.ts
const oracledb = require('oracledb');
import dbConfig from "./oracleDBConfig";
import log from "../utils/winston";
function oracleLoader(sql: string) {
const connection = oracledb.getConnection(dbConfig);
try{
connection.execute(sql);
log.info("Table created.");
} catch (e) {
log.error("SQL script do not executed!" + e);
}
}
export default oracleLoader;
oracleDBConfig.ts
function oracleDBConfig() {
return {
user: mail,
password: pass,
connectString: str
};
}
export default oracleDBConfig;
从哪里获得该用户名或我需要电子邮件?
从哪里获取密码,是数据库密码还是oracle账号密码?
从哪里获取连接字符串?
如果我有 oracle-wallet 的 .zip 文件怎么办。
请记住,我需要连接到云中存在的数据库。
注意:在const connection = oracledb.getConnection(dbConfig); 行中,我有一个警告:
Argument type () => {password: string, user: string, connectString: string} is not assignable to parameter type GetConnectionOptions
【问题讨论】:
-
你检查the documentation first了吗?它有什么问题?
-
@astentx 是的,我做到了,目前问题出在最后一个注释中,为什么我会遇到数据类型的问题
标签: javascript oracle cloud node-oracledb