I have a library method that can be used to connect to a database and then build a document using data from the database.
When they run this app with no parameters, I want to list out all available sql vendor connections. Based on this question I'm guessing its done using ServiceLoader but it's not clear to me exactly how to do this.
And critical to this is I'd like to get the class "com.mysql.jdbc.Driver", and I must get the "jdbc:mysql:" start of the connection string syntax.
So, how can I get the class (optional) and connection string start (necessary) of all JDBC connectors in the classpath?
ServiceLoader.load(Driver.class)
orDriverManager.drivers()
to list the drivers, but as far as I know, there is no way to automatically determine the syntax for a driver’s JDBC URLs. – Palestra