JDBC—Connection

版权声明:. https://blog.csdn.net/WildestDeram/article/details/89575650

Connection

Connection:数据库连接对象

主要作用:

1.创建执行SQL语句的对象

Statement createStatement()     执行SQL语句,SQL注入的时候漏洞存在(不建议使用)

PreparedStatement preparedStatement(String sql)      预编译SQL语句,解决了SQL注入漏洞的问题(后期使用1)

CallableStatement callableStatement(String slq)      执行SQL中存储过程

2.进行事务的管理

setAutoCommit()     设置事务是否自动提交

commint()     事务提交

rollback()     事务回滚

猜你喜欢

转载自blog.csdn.net/WildestDeram/article/details/89575650