import java.sql.*;
class SqlDemo{
PreparedStatement pstm;
Connection con;
ResultSet rs;
int flag;
/**
*加载驱动 获取连接
*/
public SqlDemo()throws ClassNotFoundException,SQLException{
Class.forName("驱动资源url");
con= DriverManager.getConnection("coke","jfei","jfei");
}
/**
*测试SqlDemo
*/
public static void main(String args[]){
new SqlDemo();
}
/**
*更新一条数据
*/
public int updateDate(String value1,String value2)throws SQLException{
String sql ="?,?";
pstm = con. preparedStatement(sql);
pstm.setString(value1);
pstm.setString(value2);
flag = pstm.executeUpdate();
return flag;
}
}