java当中JDBC当中请给出一个sql server的stored procedure例子

2022-10-14,,,,

3.sql server的stored procedure例子

import java.sql.*;
public class storedproc0 {
public static void main(string[] args) {
string dburl = "jdbc:jtds:sqlserver://localhost:1433/qixytest";
string user = "sa";
string password = "";

try {
class.forname("net.sourceforge.jtds.jdbc.driver");
connection con = drivermanager.getconnection(dburl, user, password);
system.out.println("connection is ok");
callablestatement cs = con.preparecall("{call all_books}");
resultset rs = cs.executequery();

while(rs.next()){
system.out.println(rs.getstring("bookname") + "\t" +
rs.getstring("authorname") + "\t" +
rs.getint("numbersold"));
}
rs.close();
cs.close();
con.close();

}
catch (exception e) {
e.printstacktrace();
}

文章转载自原文:

《java当中JDBC当中请给出一个sql server的stored procedure例子.doc》

下载本文的Word格式文档,以方便收藏与打印。