www.pudn.com > mvc12.rar > StoreTest.java
package mvc;
import java.sql.*;
public class StoreTest
{
public void doStore() throws Exception
{
DbBean db=new DbBean(); //创建DB实例
Connection conn=db.getConn(); //建立连接
String strSQL="{call demo_procedure(?,?,?,?,?,?)}"; //call一个存储过程
java.sql.CallableStatement sqlStmt=conn.prepareCall(strSQL); //建立陈述
sqlStmt.setString(1,"asiapower2");
sqlStmt.setString(2,"dadw113");
sqlStmt.setString(3,"4534");
sqlStmt.setString(4,"11");
sqlStmt.setString(5,"22");
sqlStmt.setDate(6,new java.sql.Date(new java.util.Date().getTime()));
sqlStmt.executeUpdate();
sqlStmt.close();
conn.close();
}
public int getDataBaseCount() throws Exception
{
int ret=0;
DbBean db=new DbBean();
Connection conn=db.getConn();
ResultSet rs=conn.createStatement().executeQuery("select count(*) from txl_tab");
while (rs.next())
{
ret=rs.getInt(1);
}
return ret;
}
}