Connection的preparedStatement方法对SQL进行预处理,生成数据库底层命令,并将该命令封装在preparedstatement中,可以提高数据库访问速度。
如sql=con.prepareStatement("select * from test1");
查询用sql.executeQuery()
增删改用sql.executeUpdate()
本文介绍如何使用Connection的preparedStatement方法对SQL语句进行预处理,以生成数据库底层命令并将其封装在PreparedStatement对象中,从而实现对数据库的高效访问。预处理能够显著提升增删改查操作的速度。
Connection的preparedStatement方法对SQL进行预处理,生成数据库底层命令,并将该命令封装在preparedstatement中,可以提高数据库访问速度。
如sql=con.prepareStatement("select * from test1");
查询用sql.executeQuery()
增删改用sql.executeUpdate()
1544
1289

被折叠的 条评论
为什么被折叠?