Skip to main content
 首页 » 编程设计

python之使用 VPC 通过 Lambda 连接到 Oracle 时出错

2025年01月19日13birdshome

我正在尝试使用 lambda 连接到 oracle 数据库。 我已经在 lib 中安装了所有依赖项并制作了一个 zip 容器

目录结构: `

root/ 
    lib/(client lib) 
    index.py 
    cx_oracle.so* 

`

import cx_Oracle 
 
def handler(event, context): 
    message = "" 
    cursor = None 
    connection = None     
    connection = cx_Oracle.connect("USERNAME", "PASSWORD", "DOMAIN/orcl") 
    cursor = connection.cursor() 
    cursor.execute("""QUERY""") 
    message += " {Error in connection} " + str(e) 
    if cursor: 
        cursor.close() 
    if connection: 
        connection.close() 
    return {'message' : message} 

错误是:

找不到 libaio.so 和 libclntsh.so 库

请您参考如下方法:

需要创建没有版本号的符号链接(symbolic link)。

引用这个Connecting to Oracle RDS using AWS Lambda using Python