ODBC connection to Oracle ADW without wallet

72 Views Asked by At

I want to connect to Oracle Cloud AWD with C++ ODBC driver without wallet as the exact database (the connection string) is coming from the user input. The code below can connect successfully, when I copied the wallet files into the <odbc_install_root>/network/admin folder, but when I empty out the folder, the application fails to connect.

Does anybody faced same issue?

Note

I found an example here: https://blogs.oracle.com/opal/post/easy-way-to-connect-python-applications-to-oracle-autonomous-databases

when I tested this code, seems to work, but off course, it is python, not C++ and not ODBC

    SQLHENV hEnv;
    std::cerr << SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv) << std::endl;
    std::cerr << SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0) << std::endl;
    
    SQLHDBC hDbc;
    std::cerr << SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc) << std::endl;
    
    SQLCHAR stream[] =
        "Driver={Oracle21ODBCdriver};"
        "DSN=OracleODBC-21;"
        "DBQ=<string_copied_from_the_web_page>"
        "UID=ADMIN;"
        "PWD=<admin_pwd>;";
    
    std::cerr << SQLDriverConnect(hDbc, nullptr, stream, SQL_NTS, conn_str_out, 4096, nullptr, SQL_DRIVER_COMPLETE) << std::endl;
    
    SQLHSTMT hStmt;
    std::cerr << SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt) << std::endl;
    
    SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
    SQLDisconnect(hDbc);
    SQLFreeHandle(SQL_HANDLE_DBC, hDbc);
    SQLFreeHandle(SQL_HANDLE_ENV, hEnv);
0

There are 0 best solutions below