Support for EZConnectPlus Oracle connections.

Forum related to Oracle Server

Moderators: gto, EgonHugeist, mdaems

Post Reply
MJFShark
Expert Boarder
Expert Boarder
Posts: 225
Joined: 04.06.2020, 13:59

Support for EZConnectPlus Oracle connections.

Post by MJFShark »

Hi all!

I occasionally use Oracle EZConnect syntax to avoid changing configuration files. This works fine with Zeoslib currently. In newer Oracle versions Oracle extended the syntax and called it "EZConnect Plus" and it allows many more configuration settings included "wallet_location" which is needed to connect to Oracle Cloud services. This syntax looks like:

tcps://yourhost:1522/yourdb?wallet_location="C:\DbClients\Oracle\Wallet1"

However, Zeos encodes the various connection strings into a ZURL string which uses the question mark as a delimiter, and so the question mark in the EZConnectPlus string causes problems.

I've made a very quick and dirty test by just changing the question mark to an unusual character and then changing it back in the Oracle connect function, with success, but that's obviously not a great solution. Another thought is to parse it based on the last question mark instance instead of the first, but a password containing a question mark would mess it up (as well as any connection property.).

I'm not sure how to handle this, so any thoughts appreciated.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 2008
Joined: 17.01.2011, 14:17

Re: Support for EZConnectPlus Oracle connections.

Post by marsupilami »

Hello Mark,

the first idea is to just use some kind of escape syntax - that we would have to invent yet. Another possibility is to stick to the JDBC definition and see how they solve the problem.
I didn't dive into the problem bus since JDBC uses URLs (and Zeos copied that behavior) I would assume, they use percent encoding. In that case the question mark would become %3f in the ZDBC url.
Assuming, you have to put the EZConnect Plus string into the database property of TZConnection, the ZDBC URL might look like this:
zdbc:///tcps://yourhost:1522/yourdb%3fwallet_location="C:\DbClients\Oracle\Wallet1"

This will only work, if we define, that for a Zeos URI, it is acceptable to have reserved characters in the ZDBC URI. If we define, that reserved characters should not be used, we could get an URI like this:
zdbc:///tcps%3a%2f%2fyourhost%3a1522%2fyourdb%3fwallet_location%3d%22C%3a%5cDbClients%5cOracle%5cWallet1%22

In the second version I encoded all characters that are not part of the "Unreserved Characters". For more information see https://en.wikipedia.org/wiki/Percent-encoding

In my opinion doing some kind of escaping is quick but possibly dirty. Doing the percent encoding could be the bettwer way to go. I think, we might get away with only having to modify the TZURL class and maybe TZAbstractConnection because even drivers in Zeos don't use URLs directly.

But whatever we do - I think we will have to modify Zeos to get EZConnect Plus to work.

Best regards,

Jan
MJFShark
Expert Boarder
Expert Boarder
Posts: 225
Joined: 04.06.2020, 13:59

Re: Support for EZConnectPlus Oracle connections.

Post by MJFShark »

I've put up a pull request that adds percent encoding to the URL class. I've tested it with all of my connections (including Oracle's Easy Connect Plus) and didn't see any issues. This uses the non-standard UTF16 %u type encoding when needed and leverages the existing encode and decode functions. This will affect the read-only getURL property on the connection class as it will now be semi-encoded (the individual sections of the url will be encoded, but not the entire string.)
Post Reply