sql - 热修复: not connected error when execution the sql statement, DPI-1010:not connected?

标签 sql node.js oracle error-handling node-oracledb

enter image description here当我在nodeJs中执行sql语句时,它告诉我有这样的错误!
有什么可能的解决方案?

    connection.execute("create table testmm (city varchar(10));", function(err, res) {
      if(err) {
        console.error(err);
      }
      else {
        console.log("LLLLLL");
        console.log(res);
      }
    });][1]

最佳答案

您正在尝试连接到SYSTEM帐户-除非您正在执行管理员工作,否则不要这样做。如果要创建自己的表,请创建一个应用程序用户/架构,然后以该用户身份进行连接。

我看到您正在使用本地数据库。您能够以SYS用户的身份从SQL * PLUS或SQL Developer连接到它吗?如果是这样,您可以使用它来解锁SYSTEM帐户。完成后,您可以以SYS或SYSTEM身份连接以创建新用户。这是一个执行此操作的示例脚本:

create user my_app identified by oracle  
default tablespace users
temporary tablespace temp;

grant connect to my_app;
grant resource to my_app;

grant create view to my_app;

运行完之后,您可以更新代码以使用新用户的凭据连接创建表。

最后,当您执行SQL语句时,请删除结尾的分号,否则会出现另一个错误。

关于sql - 热修复: not connected error when execution the sql statement, DPI-1010:not connected?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55403703/

相关文章:

mysql - 从非sql查询获取结果集

javascript - Sails.js index.ejs Controller 逻辑

node.js - Express应用程序的简单密码验证

java - 将 JPA 与 Oracle 一起使用并按小时分组时出现问题

java - SQL 语句不适用于 Oracle JDBC

php - SQL主键重新排序的简明方法

c# - LINQ to SQL 和自关联表

php sql 查询没有返回正确的结果

node.js - 获取传入请求的 HTTP 版本

sql - CTAS 功能