package Opertion;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Testlmpl implements JustAvatar {
Connection connect;
StringBuffer sb;
PreparedStatement preparedStatement;
ResultSet resultSet;
public void boardlmpl(HttpServletRequest request,
HttpServletResponse response) {
response.setContentType("text/xml");
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:taehun";
connect = DriverManager.getConnection(url, "scott", "xogjs");
String sqlStr = "SELECT * FROM login";
preparedStatement = connect.prepareStatement(sqlStr);
resultSet = preparedStatement.executeQuery();
sb = new StringBuffer();
sb.append("\n");
sb.append("\n");
while (resultSet.next()) {
sb.append("\n");
sb.append("" + resultSet.getString("id") + "\n");
sb.append("" + resultSet.getString("pass") + "\n");
sb.append("\n");
}
sb.append("");
PrintWriter pw = response.getWriter();
pw.println(sb.toString());
resultSet.close();
preparedStatement.close();
connect.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}