admin管理员组文章数量:1122832
I am trying to connect my NestJS application to Oracle Autonomous Database using TypeORM. I have configured everything in TypeORM, but I am facing issues.
I tried to set up the app.module.ts
with the necessary settings, but it doesn't work.
Here is my app.module.ts
configuration:
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true, envFilePath: '../../.env' }),
TypeOrmModule.forRoot({
type: 'oracle',
host: 'adb.sa-saopaulo-1.oraclecloud',
sid: '<ssid>_high.adb.oraclecloud',
database: '<db_name>',
username: '<username>',
password: '<password>',
connectString: '<database>_high',
autoLoadEntities: true,
synchronize: true,
logging: true,
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
My .env
has the TNS_ADMIN
variable set like this:
// Other .env variables that are being used directly
TNS_ADMIN=../../wallet/Wallet_<database>
Basically, the error I get is the following:
[Nest] 58658 - 22/11/2024, 15:42:56 ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
Error: NJS-511: connection to listener at host <ip addrs> port 1522 was refused. (CONNECTION_ID=...)
Cause: ORA-12506
at Object.throwErr (...node_modules/oracledb/lib/errors.js:693:10)
at NetworkSession.connect2 (/.../node_modules/oracledb/lib/thin/sqlnet/networkSession.js:244:18)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async NetworkSession.connect1 (.../node_modules/oracledb/lib/thin/sqlnet/networkSession.js:320:23)
at async NetworkSession.connect (.../node_modules/oracledb/lib/thin/sqlnet/networkSession.js:542:5)
at async ThinConnectionImpl.connect (.../node_modules/oracledb/lib/thin/connection.js:775:5)
at async ThinPoolImpl.bgThreadFunc (.../node_modules/oracledb/lib/thin/pool.js:455:11)
^C
The problem doesn't seem to be related to ACL filtering because I can connect to the server using the SQL Developer client, and I have accepted my own IP address in the OCI configuration.
oracle developer client connection
I tried to connect my NestJS application to Oracle Autonomous Database using TypeORM and Oracle Wallet. I configured the app.module.ts file with the necessary connection details and set the TNS_ADMIN variable in my .env file to point to the wallet directory. I expected the connection to work, similar to how it works in Oracle SQL Developer, with SSL/TLS configuration for secure communication.
However, I am receiving the NJS-511: connection to listener was refused error with ORA-12506, indicating that the connection to the database is being blocked or not established correctly.
本文标签: typescriptHow to Connect NestJS with Oracle Autonomous Database using TypeORMStack Overflow
版权声明:本文标题:typescript - How to Connect NestJS with Oracle Autonomous Database using TypeORM - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299792a1930585.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论