Java connects to MySQL database through JDBC
JDBC (Java Data Base Connectivity) is a Java API used to execute SQL statements. It can provide unified access to a variety of relational databases. It is composed of a group of classes and interfaces written in Java language. JDBC provides a benchmark, which can build more advanced tools and interfaces to enable database developers to write database applications.
If you want to use a database, you need to add a database driver. Different databases have different drivers, which will not be explained one by one here. The method of adding a jar driver package is not explained here,
There is an introduction in another article http://www.jb51.net/article/47945.htm
The following is an example to introduce the connection of MySQL database. The methods of other databases are similar.
In addition, the method of connecting various databases with JDBC (Classic) is attached
1) Connecting Oracle 8 / 8i / 9i / 10g / 11g (thin mode)
2) Connect to DB2 database
3) Connect to MySQL database
4) Connecting to SQL Server2000 database
5) Connect to PostgreSQL database
6) Connect to access database