The invention relates to a unified
SQL execution and query method and
system. The method comprises the following steps: obtaining
database related information, inquiring a matching
database, selectingthe
database, wherein the database is used for executing
SQL statements; receiving an
SQL statement, checking whether the SQL statement is in a white
list; if the SQL statement is in the white
list,checking the SQL grammar, and if the grammar is correct, analyzing the type of the SQL statement; and transferring the SQL statement into a
server for execution, and returning a
result set. Accordingto the invention, a related information instance name or ip is input; database operation and maintenance personnel can execute SQL without
logging in the database; the database ip, the port, the username, the
password and other information do not need to be owned, a
bastion host and a springboard
machine are not needed, the SQL can be issued to different database instances in a unified mode, batch databases are supported to execute the unified SQL, and in addition, a white
list is arranged, so that the safety of a database
system is improved.