Class MysqlUrlParser
java.lang.Object
io.opentelemetry.instrumentation.jdbc.internal.parser.MysqlUrlParser
- All Implemented Interfaces:
JdbcUrlParser
Parser for MySQL and MariaDB JDBC URLs.
Sample URLs:
- mysql://host:3306/db
- mysql://host/db?user=root
- mysql:aurora://host:3306/db
- mysql:host:3306/db (non-standard format)
- mariadb:replication://host1,host2/db
- mariadb:sequential:address=(host=host1)(port=3306)(user=root)/db
- mysql://[::1]:3306/db (IPv6)
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidparse(String jdbcUrl, ParseContext ctx) Parse the JDBC URL and populate the context with extracted information.
-
Field Details
-
INSTANCE
-
-
Method Details
-
parse
Description copied from interface:JdbcUrlParserParse the JDBC URL and populate the context with extracted information.Implementations are responsible for the full parsing lifecycle:
- Set driver-specific defaults (system name, default host/port/user)
- Call
ParseContext.applyDataSourceProperties()orParseContext.applyUserProperty()at the appropriate point to match driver-specific precedence semantics. UseapplyUserProperty()for drivers whose DataSource does not support the standard serverName/portNumber/databaseName properties. - Parse the URL structure
The placement of
ParseContext.applyDataSourceProperties()controls precedence:- Before URL parsing: URL values take precedence (e.g., PostgreSQL, MySQL, Oracle)
- After URL parsing: DataSource properties take precedence (e.g., Microsoft SQL Server)
- Specified by:
parsein interfaceJdbcUrlParser- Parameters:
jdbcUrl- the JDBC URL to parse (without the "jdbc:" prefix)ctx- the parse context containing type and optional DataSource properties
-