1.DBUtils is a database operation utility in Java programming, small and simple and practical, how does it manage things?
We all know that in JDBC, things are controlled by connection objects.
One of the core classes of the Dbutils tool class is Queryrunner
The main explanation here is that empty constructors and parameters are the constructors of the link pool.
parameter is the constructor of the link pool, we give the link to dbutils to manage, the thing also to Dbutils to manage, adopt the MySQL default to manage the way of the thing, a SQL language one commits
Queryrunner (DataSource DS)
Update (String sql, Object ... params)
Query (String sql, resultsethandler<t> rsh, Object ... params)
These three SQL statements should be put together.
The empty constructor, the link is to the developer to manage, the thing is also to the developer to manage, need to manually commit and rollback things
Queryrunner ()--indicates that the underlying does not manage the connection for you, manage the connection yourself
Update (Connection conn, String sql, Object ... params)
Query (Connection conn, String sql, resultsethandler<t> rsh, Object ... params)
These three SQL statements should be used together.
Dbutils Using transactions