Simple example of using JDBC to operate database in Java
•
Java
I haven't written any database applications for a long time. Here's a review of Java JDBC.
1. Using java JDBC to operate the database generally requires 6 steps:
(1) Establish JDBC bridge and load database driver;
(2) Connect to the database and obtain the connection object (use the database connection address, user name and password);
(3) Obtain the database statement object;
(4) Execute database operation;
(5) Read the results;
(6) Close the database connection;
2. Use Java JDBC operation database (MySQL) code:
To connect to the MySQL database, you need to import the MySQL database jar package. This code uses mysql-connector-java-5.1 18-bin. jar。
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码