I need your help writing my java program, I want a way to connect to a server without specifying the database. Then, execute a query on the server that lists the databases, the user chooses one, so the program connects to the chosen database. The server is a Microsoft SQL server. For now, I am using jpa persistence.xml to connect to the server and the database, but this way is static, I have to specify the database within persistence.xml to connect to it. The way I want it is to not specify the database, just specify the server in the persistence file. Then, execute a query on the server like:
SELECT name FROM master.sys.databases
get the names, then the user choose one of the databases, and the program would connect to the database specified.