Supported container runtimes

Oracle Free

qianmoQqianmoQ· 更新于 2026-10-19· 阅读 3 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Oracle Free

Install

1
npm install @testcontainers/oraclefree --save-dev

Examples

These examples use the following libraries:

Recommended to use an image from this registry and substitute for IMAGE

Start a database and execute queries

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
const customDatabase = "TESTDB";
const customUsername = "CUSTOMUSER";
const customPassword = "customPassword";
await using container = await new OracleDbContainer(IMAGE)
  .withDatabase(customDatabase)
  .withUsername(customUsername)
  .withPassword(customPassword)
  .start();

const connection = await oracledb.getConnection({
  user: container.getUsername(),
  password: container.getPassword(),
  connectString: container.getUrl(),
});

const result = await connection.execute("SELECT SYS_CONTEXT('USERENV', 'CON_NAME') FROM DUAL");
expect(result.rows?.[0]).toEqual([customDatabase]);

const resultUser = await connection.execute("SELECT USER FROM DUAL");
expect(resultUser.rows?.[0]).toEqual([customUsername]);

await connection.close();

评论

登录后参与评论

正在加载评论…