The present invention relates to a method for
database proxy protection and dynamic configuration. The method includes: obtaining data sources, user configuration information, and rule configuration information by periodically calling an
external interface, and dynamically creating
database proxy services with different proxy ports; the
proxy service periodically obtains relevant data with its own proxy port as a key from the process that created the
proxy service, and periodically obtains the current
data source, user configuration information, and rule configuration information; after the
proxy service obtains the information, it compares it with the last cached information, modifies the
data source generation
library, and sets the access users of the proxy
database according to changes in user data; for users who need to be configured through
YAML, the yamlConfig in the context reading part of the
source code is modified, so that the information in the
Java program memory variables actually read is changed, thereby realizing dynamic modification of the user. Through this solution, a secure database proxy can be realized, and users accessing the proxy database can be dynamically controlled.