Bug #35753 jdbc useOldAliasMetadataBehavior connection property not set
Submitted: 1 Apr 2008 23:39 Modified: 16 Jul 15:10
Reporter: Zeph Harben
Status: Closed
Category:Connector/J Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Target Version:
Triage: D3 (Medium)

[1 Apr 2008 23:39] Zeph Harben
Description:
Upgrading from MYSQL Connector/J 3.1 => 5.1; Per the documentation in order to be
JDBC-compliant, the default behavior doesn't support referencing table/column aliases.

Attempted to use the "useOldAliasMetadataBehavior" connection property to override the
default - here is the URL format being used :

db_connection_url=jdbc:mysql://[server]/[database]?useUnicode=true&characterEncoding=UTF-8&jdbcCompliantTruncation=false&useOldAliasMetadataBehavior=true

The other properties are handled correctly [useUnicode, characterEncoding,
jdbcCompliantTruncation] however "useOldAliasMetadataBehavior" is ignored.

In com.mysql.jdbc.NonRegisteringDriver.parseURL(String url, Properties defaults), the
following code appears to override the URL properties with the defaults [lines 748 -
758]:

// Properties passed in should override ones in URL

if (defaults != null) {
	Iterator propsIter = defaults.keySet().iterator();

	while (propsIter.hasNext()) {
		String key = propsIter.next().toString();
		String property = defaults.getProperty(key);
		urlProps.setProperty(key, property);
	}
}

How to repeat:
use a connection URL with the "useOldAliasMetadataBehavior" property set to "true" and
check whether or not the resulting connection has been set correctly.

Suggested fix:
I suggest that NonRegisteringDriver.parseURL() override the defaults with whatever
properties are specified in the URL, as this is the documented/suggested way to override
the connector defaults.
[3 Apr 2008 1:09] Zeph Harben
Downgrading to S3/Non-critical since you can use
MysqlDataSource.setUseOldAliasmetadataBehavior() to work-around the JDBC URL issue.
[3 Apr 2008 22:10] Sveta Smirnova
Thank you for the report.

I was not able to repeat described behavior on my side. Could you please provide
repeatable test case?
[3 Apr 2008 22:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44888
[30 Jul 2008 16:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/50724
[1 Jul 23:08] Mark Matthews
This got fixed in 5.1.7, but missed a bug status state to get it documented in the manual.
[16 Jul 15:10] Tony Bedford
An entry was added to the 5.1.7 changelog:

The useOldAliasMetadataBehavior connection property was ignored.