我想使用TypeORM连接到Oracle数据库
createConnection().then(async connection => {
const app = express();
const userRepository = getRepository(User);
const users = await userRepository.find();
console.log(users);
app.listen(3000);
}).catch(error => console.log("xxx",error));
ormconfig.json
文件位于 ./Myproject/ormconfig.json
,但是报错了:Error: No connection options were found in any orm configuration files.
使用这些设置,我已经通过 oracledb 连接到数据库了。
请帮我解决这个问题。
更新
我使用以下命令生成项目:typeorm init --name MyProject --database oracle
。这是 typeorm 的默认结构。
your_project/src/ormconfig.json
。您应该将其移动到your_project/ormconfig.json
。@ashkufaraz - spike 王建./src
目录下。你必须将它移动到上一级。 - 303