Description:
The useConfigs configuration bundles appear to be broken in mysql-connector-java version 6.0.5. When useConfigs=maxPerformance is added to the URL, an InvalidConnectionAttributeException is thrown with the following stack trace:
Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: Can't find configuration template named 'maxPerformance'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)
at com.mysql.cj.core.conf.url.ConnectionUrl.getPropertiesFromConfigFiles(ConnectionUrl.java:382)
at com.mysql.cj.core.conf.url.ConnectionUrl.expandPropertiesFromConfigFiles(ConnectionUrl.java:365)
at com.mysql.cj.core.conf.url.ConnectionUrl.collectProperties(ConnectionUrl.java:317)
at com.mysql.cj.core.conf.url.ConnectionUrl.<init>(ConnectionUrl.java:292)
at com.mysql.cj.core.conf.url.SingleConnectionUrl.<init>(SingleConnectionUrl.java:38)
at com.mysql.cj.core.conf.url.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:202)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:194)
... 3 more
How to repeat:
Attempt to create a connection with URL: jdbc:mysql://address=(protocol=tcp)(host=<redacted>)(port=<redacted>)/test?user=<redacted>&useConfigs=maxPerformance. Can reproduce running JDK 1.8u101 and attempting to connect via the above URL.
Suggested fix:
Update the code in ConnectionUrl.java (https://github.com/mysql/mysql-connector-j/blob/release/6.0/src/main/java/com/mysql/cj/cor...) to use a fully qualified path to the /com/mysql/cj/configurations/*.properties resources, rather than a path relative to the com.mysql.cj.jdbc.Driver class.