DBUtils usage transaction
1.DBUtils is a database operation utility in java programming. It is small, simple and practical. How does it manage things?
We all know that in jdbc things are controlled by Connection objects.
The core class of the DBUtils utility class is QueryRunner
Here it is mainly explained that the empty constructor and the parameter are the constructor of the link pool.
The parameter is the constructor of the link pool, which means that we hand over the link to DBUtils to manage, and the things to be managed by DBUtils. Mysql adopts the default way of managing things, one sql language and one submission.
QueryRunner (DataSource ds)
Update (String sql, Object... Params)
Query (String sql, ResultSetHandler rsh, Object... Params)
These three sql statements should be used together.
Empty constructor, links are left to developers to manage, things are also left to developers to manage, need to manually commit and roll back things
QueryRunner ()-- indicates that the underlying layer does not help you manage the connection, but manages the connection yourself.
Update (Connection conn, String sql, Object... Params)
Query (Connection conn, String sql, ResultSetHandler rsh, Object... Params)
These three sql statements should be used together