简体   繁体   English

将Google Cloud Function连接到Oracle数据库

[英]Connect google cloud function to an oracle database

Does anyone know, how to connect google cloud function(Python) to an Oracle database ? 有谁知道如何将Google Cloud Function(Python)连接到Oracle数据库? I tried importing cx_Oracle library in cloud function. 我尝试在云函数中导入cx_Oracle库。 But it shows an error 但是显示错误

Function load error: DPI-1047: Oracle Client library cannot be loaded: libclntsh.so: cannot open shared object file 函数加载错误:DPI-1047:无法加载Oracle客户端库:libclntsh.so:无法打开共享对象文件

Following is main.py code: 以下是main.py代码:

import cx_Oracle

def import_data(request):

    request_json = request.get_json()
    if request_json and 'message' in request_json:
        con = cx_Oracle.connect("username", "password", "host:port/SID")
        print(con.version)
        con.close

Following is requirement.txt 以下是requirement.txt

# Function dependencies, for example:
# package>=version
cx_Oracle==6.0b1 

It seems Google Cloud Functions does not support shared libraries (in other words, it only supports "pure python" libraries) and that cx_oracle depends on this. 似乎Google Cloud Functions 不支持共享库 (换句话说,它仅支持“纯python”库),而cx_oracle依赖于此。 Sadly I haven't been able to find a pure-python Oracle library, so for now this is not supported. 遗憾的是,我无法找到纯Python的Oracle库,因此目前不支持此库。

Your best bet is to use App Engine Flexible as it the closest equivalent service that allows non-pure python libraries . 最好的选择是使用App Engine Flexible,因为它是允许使用非纯python库的最接近的等效服务。 cl_oracle should work with it. cl_oracle应该使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM