import
java.sql.
*
;
public class ProcedureTest {
public static void main(String[]args) {
try {
Class.forName( " com.microsoft.jdbc.sqlserver.SQLServerDriver " );
Stringurl = " jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs " ;
Connectionconn = DriverManager.getConnection(url, " sa " , "" );
CallableStatementcst = conn.prepareCall( " {callgetMp3()} " );
ResultSetrs = cst.executeQuery();
while (rs.next()) {
System.out.println(rs.getString( 2 ));
}
} catch (Exceptionex) {
ex.printStackTrace();
}
}
}
public class ProcedureTest {
public static void main(String[]args) {
try {
Class.forName( " com.microsoft.jdbc.sqlserver.SQLServerDriver " );
Stringurl = " jdbc:microsoft:sqlserver://localhost:1433;databasename=pubs " ;
Connectionconn = DriverManager.getConnection(url, " sa " , "" );
CallableStatementcst = conn.prepareCall( " {callgetMp3()} " );
ResultSetrs = cst.executeQuery();
while (rs.next()) {
System.out.println(rs.getString( 2 ));
}
} catch (Exceptionex) {
ex.printStackTrace();
}
}
}
getMp3()是存储过程的名字;
我用的sql2000的数据库