First, there is a properties file in the database
The contents are in the form of a key-value pair.
For example
driver=com.mysql.jdbc.driverurl=jdbc:mysql://localhost:3306/testuser=rootpwd=950218
Then set a class to read inside the Driver,url and so on
For example:
Public classMasterutil {Private StaticString URL; Private StaticString User; Private StaticString pwd;Static{resourcebundle Rbundle= Resourcebundle.getbundle ("Database"); String Driver= rbundle.getstring ("Driver"); Try{class.forname (driver); This is the driver that loads the database, calls the driver in the file; URL= rbundle.getstring ("url"); User= rbundle.getstring ("User"); PWD= Rbundle.getstring ("pwd"); } Catch(Exception e) {e.printstacktrace (); }}}
Then the contents are read out and appear in the form of global variables; just call it right back.
How to read the properties file contents of a database into Java