import java.io.*;
import java.sql.*;
import java.util.Date;

public class ChangeItem
{
	public ChangeItem()
	{
	}

	public void loadDriver() throws ClassNotFoundException, Exception
	{
  		Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
	}


	public BoardData change(String num, String password) throws SQLException
	{
		String query = "select BNUM, BDATE, BNAME, BEMAIL, BTITLE, BDETAIL,BPASSWORD from board where BNUM = "
	                            +num.trim() + " and BPASSWORD = '" + password + "'";
		BoardData data=null;

		String url="jdbc:oracle:thin:@129.254.75.152:1521:orcl816";
		Connection con;
		Statement stmt;
   		con = DriverManager.getConnection(url, "scott", "tiger");
   		stmt = con.createStatement();

   		ResultSet rs = stmt.executeQuery(query);
   		rs.next();

   		Date bdate = rs.getDate("BDATE");
		String btitle = rs.getString("BTITLE");
		String bname = rs.getString("BNAME");
		String bemail = rs.getString("BEMAIL");
		String bdetail = rs.getString("BDETAIL");
		String bpassword = rs.getString("BPASSWORD");

		data = new BoardData(0, bdate, btitle, bname, bemail, bpassword, bdetail);

		stmt.close();
		con.close();

	 	return data;
	}
}
