Hello innovative programmers, I would like to know if it is possible to obtain the name of the schema or database to which I am connected when establishing the connection in MySQL with java, if it is possible, would you tell me how?
I already tried with DataBaseMetaData but I couldn't even use that object.
You say you used DataBaseMetaData, but did you use the getUrl() method?
connection.getMetaData().getURL()
If it doesn't work for you, try using Catalog as explained in this SOeng answer: https://stackoverflow.com/questions/26441303/get-the-connected-mysql-database-name-jdbc