lovetodream / oracle-nio

Non-blocking, event-driven Swift client for Oracle DBs. Does not require OCI or ODPI.
https://swiftpackageindex.com/lovetodream/oracle-nio/documentation/oraclenio
Apache License 2.0
30 stars 4 forks source link

Documentation issue(?): port with mTLS authentication #57

Closed kicsipixel closed 1 month ago

kicsipixel commented 1 month ago

According to OracleNIO documentation the configuration is the following to connect to Oracle Autonomous Databases using mTLS:

let config = try OracleConnection.Configuration(
    host: "adb.eu-frankfurt-1.oraclecloud.com",
    port: 1521,
    service: .serviceName("my_service_name_low.adb.oraclecloud.com"),
    username: "my_username",
    password: "my_secure_password",
    tls: .require(.init(configuration: .makeOracleWalletConfiguration(
        wallet: "/path/to/Wallet_xxxx",
        walletPassword: "wallet_password"
    )))
)

According to Oracle documentation that port is 1522: "Using Mutual Transport Layer Security (mTLS), clients connect through a TCPS (Secure TCP) database connection using standard TLS 1.2 with a trusted client certificate authority (CA) certificate. With mutual authentication both the client application and Autonomous Database authenticate each other. Autonomous Database uses mTLS authentication by default (use port 1522 to connect with mTLS)."

Using port: 1522 works with wallet and 1521 doesn't work for me.

lovetodream commented 1 month ago

Yep, there's a typo. Do you think the documentation needs more explanation, or was it clear enough for you (besides the port thing)?

kicsipixel commented 1 month ago

Well, I am not the sharpest and I understood it. Maybe if you can somehow highlight the important data in the Connection string would be helpful i.e:

description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.eu-frankfurt-1.oraclecloud.com))(connect_data=(service_name=my_service_name_low.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))

To be honest I tried to find the info on ADB panel inside OCI. This is an interesting topic, so I am planning to make an article about it, just trying to figure out how to use Bundle instead of Public folder.

lovetodream commented 1 month ago

Good idea, I'll add that.

You can use the bundle if you add the resources array to your Target in the Package.swift. Here's an example: https://github.com/lovetodream/oracle-nio/blob/60452f3c5377a48c00976afa48ff7e92ef739e07/Package.swift#L53-L57 https://github.com/lovetodream/oracle-nio/blob/60452f3c5377a48c00976afa48ff7e92ef739e07/Tests/IntegrationTests/LOBTests.swift#L26-L30

If this is about adding the wallet, I'd recommend setting an Environment variable with the absolute path to your wallet. Your wallet shouldn't be part of the source files.