[CONJ-227] 'mariadb' alias doesn't work with HA mode Created: 2015-11-30  Updated: 2015-11-30  Resolved: 2015-11-30

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.3.0, 1.3.2, 1.3.1
Fix Version/s: 1.3.3

Type: Bug Priority: Minor
Reporter: Soichiro Kashima Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Hi,
I'm going to use the MariaDB Connector/J with failover options,
but when I use URL format like 'jdbc:mariadb:failover://', UrlParser throws an exception.
(Connector/J 1.3.2)

java.sql.SQLException: url parameter error '' is a unknown parameter in the url jdbc:mysql::failover://192.168.33.10:3306,192.168.33.11:3306/testj
        at org.mariadb.jdbc.UrlParser.parseInternal(UrlParser.java:193) ~[mariadb-java-client-1.3.2.jar:na]
        at org.mariadb.jdbc.UrlParser.parse(UrlParser.java:146) ~[mariadb-java-client-1.3.2.jar:na]
        at org.mariadb.jdbc.Driver.connect(Driver.java:95) ~[mariadb-java-client-1.3.2.jar:na]
...

'jdbc:mysql:failover://' works, so it’s not a big problem, but I think it should be fixed.

I think this is the cause:
https://github.com/MariaDB/mariadb-connector-j/blob/1.3.2/src/main/java/org/mariadb/jdbc/UrlParser.java#L146

I'll send a pull request to fix this on GitHub later.

Thanks.



 Comments   
Comment by Diego Dupin [ 2015-11-30 ]

Thanks for reporting !

The problem is not only when using HA parameters, but when using Datasource too.

That will be corrected in 1.3.3.

commit : https://github.com/MariaDB/mariadb-connector-j/commit/4a5b824e051ff277f1ad2baee08b8d64a63692b4
travis : https://travis-ci.org/MariaDB/mariadb-connector-j/builds/93992443

Generated at Thu Feb 08 03:14:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.