Java可以调用它的存储过程,你用存储过程写一下;具体的调用方法去查查MSDN,我只会Oracle的
解决方案 »
- 求,获取客户端硬件信息方案!!!!
- struts 窗口问题
- 请做过大型Java Web开发的大虾指点……
- 求助 如何实现jsp 上传文件的功能
- 求助:while/if嵌套问题或者什么原因麻烦高手看下,急!!!!!!
- servlet在后台文件下载后打算刷新页面报错
- 用while循環生成的input為何當第1行input為空時﹐第2行取不到值﹖
- 怎么把jsp页面中的参数传到javaScript中,小弟刚刚学javaScript
- 学jsp和tomcat又遇到了麻烦
- 数据库连接不上,求给力解答,满意答案直接给50分
- 心急如焚!如何打开一个doc文件?
- 求助:如何解决JSP程序在中文windows下正常显示,在英文windows下乱码?
大致是这样的 Connection conn=null;
String qs = null; try {
Class.forName(driver).newInstance(); conn=DriverManager.getConnection(url,"sa","");
qs="select ID,dbo.getOnlineTime(NowTime) as 'online' from Tablename where.....";
PreparedStatement stmt = conn.prepareStatement(qs);
//stmt.setString(1,"B"); //set value of parameter ,if needed
ResultSet rs = stmt.executeQuery();
while( rs.next()){
System.out.println(rs.getString(1));
}
rs.close();
conn.close();
conn=null;
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally{
if (conn!=null){
try{
conn.close();
conn = null;
}catch(Exception ex){}
}