The JAMon 2.7 JDBC Proxy Driver contains a URL parsing error when used with Sun JRE 1.5.
The documentation at "http://jamonapi.sourceforge.net/#WhatsNew22" states the JAMon JDBC Proxy URL syntax is as follows:
[BEGIN CODE]
Class.forName("com.jamonapi.proxy.JAMonDriver");
String url = "jdbc:jamon:sybase.Tds:MyServerDNS:2638?jamonrealdriver=com.sybase.jdbc2.jdbc.SybDriver";
[END CODE]
However, the JAMon JDBC Driver class "com.jamonapi.proxy.JAMonDriver" does not strip the "?" between the target URL and the "jamonrealdriver" parameter, resulting in a redundant trailing "?" being passed to the real JDBC driver ... and failing.
Thus, the JAMon JDBC URL
jdbc:jamon:sybase.Tds:MyServerDNS:2638?jamonrealdriver=com.sybase.jdbc2.jdbc.SybDriver
should be rewritten by class JAMonDriver$URLInfo as
jdbc:sybase.Tds:MyServerDNS:2638
but is actually being rewritten by class JAMonDriver$URLInfo as
jdbc:sybase.Tds:MyServerDNS:2638?
Note the redundant trailing "?".
The problem occurs at line # 174 of class "JAMonDriver", inside inner class "URLInfo" ...
[BEGIN CODE]
realURL = realURL.replaceAll("jamonrealdriver[\\s=\\.\\w]*[\\W]?", "");
[END CODE]
The replace patterns needs amending for Sun JRE 1.5 to strip the trailing "?", or another replace statement is required to strip the trailing "?".
Perhaps the "replaceAll" pattern behaves differently with other JREs.
The only current workaround is to use a JAMon JDBC URL without a ?" as follows :
jdbc:jamon:sybase.Tds:MyServerDNS:=2638jamonrealdriver=com.sybase.jdbc2.jdbc.SybDriver
Note, there is no "?" between the real JDBC URL and the "jamonrealdriver" parameter.
Logged In: NO
Unfortunately special characters vary depening on the driver that is being used. In this case the sybase driver chooses to treat the ending '?' with nothing following it as an error. I suspect other drivers could treat this as legal syntax. The solution as designed is the one you came up with. 'jamonrealdriver-xxxxx' is simply removed from the url regardless of the character used before 'jamonreaddriver'.
So this is valid: jdbc:jamon:sybase.Tds:MyServerDNS:=2638jamonrealdriver=com.sybase.jdbc2.jdb
c.SybDriver
Logged In: YES
user_id=1667067
Originator: YES
To nobody (well, really somebody) ...
agreed that some JDBC driver may ignore the trailing "?" when parsing the connection URL ... but not all.
Given that the "real" URL does not have a trailing "?" and the "?" is only used as a parameter separator in the "JAMon" URL, it makes sense for the trailing "?" to be removed when parsing the "real" URL from the "JAMon" URL.
The example at "http://jamonapi.sourceforge.net/#WhatsNew22" is a good example of the "before" and "after". The URL parsing should extract the "before" URL.
As of JAMon 2.7, the JDBC URL example at "http://jamonapi.sourceforge.net/#WhatsNew22" is incorrect.
As I see it, this is a defect that can be easily fixed.
Comments welcome; patches better ;)