UpdateSQL does not actually update the database, it just outputs SQL.
The reason it needs the database connection information and makes an actual connection because it needs to select from the databasechangelog table to determine which changeSets have been ran and which have not.