使用CallableStatement存储过程查询数据库
来源:互联网 发布:淘宝小棉袄衣服 编辑:程序博客网 时间:2024/04/28 00:56
使用CallableStatement存储过程查询数据库
package jdbctest01;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import com.lile.jdbc.util.DBUtil;
public class Demo2 {
public static void main(String[] args) {
//连接数据库
Connection conn = DBUtil.getConnection();
PreparedStatement pst = null;
try {
CallableStatement cs=conn.prepareCall("{call sp06(?,?)}");
cs.setInt(1, 1);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
String bookName = cs.getString("t_bookName");
DBUtil.closeConn(conn, pst);
System.out.println("bookName:"+bookName);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import com.lile.jdbc.util.DBUtil;
public class Demo2 {
public static void main(String[] args) {
//连接数据库
Connection conn = DBUtil.getConnection();
PreparedStatement pst = null;
try {
CallableStatement cs=conn.prepareCall("{call sp06(?,?)}");
cs.setInt(1, 1);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
String bookName = cs.getString("t_bookName");
DBUtil.closeConn(conn, pst);
System.out.println("bookName:"+bookName);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
0 0
- 使用CallableStatement存储过程查询数据库
- 使用CallableStatement调用存储过程
- 使用CallableStatement执行存储过程
- 使用CallableStatement处理Oracle数据库的存储过程
- callablestatement存储过程
- 调用存储过程CallableStatement
- callablestatement存储过程
- 存储过程和CallableStatement
- jdbc CallableStatement存储过程
- CallableStatement执行存储过程
- callablestatement调用存储过程
- CallableStatement执行存储过程
- 老调重弹:JDBC系列 之 存储过程 CallableStatement(创建和使用)
- 初学JDBC(七)-使用CallableStatement接口调用存储过程
- 老调重弹:JDBC系列 之 存储过程 CallableStatement(创建和使用)
- 请教:使用存储过程查询数据库
- java代码调用数据库的存储过程和函数 CallableStatement的用法
- CallableStatement java中调用存储过程
- STM32 DMA 疑问解答
- Fresco图片框架内部实现原理探索
- 调查“邮件门” FBI发现1.5万漏交邮件
- Hibernate--事务管理
- iOS-textView文本换行高度自动适应
- 使用CallableStatement存储过程查询数据库
- JMS入门(五)--消息头
- Ansible安装过程中遇到过的问题
- activity动态设置主题
- hibernate框架核心组件
- activityinstrumentationtestcase2 排坑
- JAva爬虫之处理HTTP状态码
- python
- 通过mysqlnow()函数校正本地(windows)时间与服务器(linux)时间