Retrieving the database connection URL does not have a built-in function that returns the name of the database. However, you can use DatabaseMetaData to return the connection URL of any local Connection. Database connection URLretrieving from database /* in java */ String myURL = conn.getMetaData().getURL();