其他分享
首页 > 其他分享> > Jdbc API

Jdbc API

作者:互联网

DriverManager 驱动管理类

getConnection(url,user,password)获取到连接

 

Connection 接口

createStatement创建statement对象

preparedStatement(sql)生成预处理对象

 

Statement 接口

executeUpdate(sql)执行dml语句,返回影响的行数

executeQuery(sql)执行查询语句,返回ResultSet对象

execute(sql)执行任意sql语句,返回布尔值

 

PreparedStatement 接口

executeUpdate() 执行dml

executeQuery() 执行查询,返回ResultSet对象

execute() 执行任意sql,返回布尔值

setXxx(占位符索引,占位符的值) 解决sql注入

setObject(占位符索引,占位符的值)

 

ResultSet 接口

next() 向下移动一行,如果没有下一行,返回false

previous() 向上移动一行,如果没有上一行,返回false

getXxx(列的索引/列名) 返回对应列的值,接收类型为Xxx

getObject(列的索引/列名) 返回对应列的值,接收类型为Object

标签:返回,Jdbc,ResultSet,接口,占位,索引,API,sql
来源: https://www.cnblogs.com/CAI-STUDY/p/16463444.html