Closed xjr100419 closed 6 years ago
Connection URL Syntax: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html
database The default database or catalog to open. If the database is not specified, the connection is made with no default database.
So, you didn't set the database in your connection URL. Right?
If so, @ascrutae I think you should consider this as a special case. By the MySQL Connector official doc, it is allowed and legal.
@wu-sheng @ascrutae
FYI this issue still appears in latest release.
ERROR 2020-10-29 19:22:38:040 main StaticMethodsInter : class[class com.mysql.cj.jdbc.ConnectionImpl] after static method[getInstance] intercept failure:String index out of range: -14 java.lang.StringIndexOutOfBoundsException: String index out of range: -14
Caused by
ds.setUrl("jdbc:mysql://" + url + ":" + AWS_RDS_INSTANCE_PORT);
Adding in /dbName fixes issue.
Great software so far!
My orm framework mysql link does not specify the database: protocol//[hosts][/database][?properties] -> protocol//[hosts][?properties]
In code MysqlURLParser.fetchDatabaseHostsIndexRange()
protected URLLocation fetchDatabaseHostsIndexRange() { int hostLabelStartIndex = url.indexOf("//"); int hostLabelEndIndex = url.indexOf("/", hostLabelStartIndex + 2); return new URLLocation(hostLabelStartIndex + 2, hostLabelEndIndex); }
then it report an error
ERROR 2018-05-31 10:21:06 InstMethodsInter : class[class com.mysql.jdbc.Driver] after method[connect] intercept failure java.lang.StringIndexOutOfBoundsException: String index out of range: -14 at java.lang.String.substring(String.java:1967) at org.apache.skywalking.apm.plugin.jdbc.connectionurl.parser.MysqlURLParser.parse(MysqlURLParser.java:59) at org.apache.skywalking.apm.plugin.jdbc.connectionurl.parser.URLParser.parser(URLParser.java:48)