I want to verify if my database exists before continuing with the execution of my program, but I don't know where to start, because I have looked at some examples and nothing has worked for me.
This is the query you want to throw:
"SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'Data_base'"
After researching and a few tests I found the solution, create this function to check if it exists, using the jdbc driver:
I hope it will help you in case you are looking for something similar
Having previously made a connection to some other base and doing:
You can use the show databases query with like:
And it checks if the query returns a result.