protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
// response.getWriter().append("Served at: ").append(request.getContextPath());
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/sampledb?user=root&password=");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT userid,status FROM userinfo");
response.setContentType("text/plain");
while (rs.next()) {
response.getWriter().write("userid=" + rs.getString("userid") + ", ");
response.getWriter().write("status=" + rs.getString("status") + "\n");
}
} catch(Exception e) {
e.printStackTrace();
} finally {
if (rs != null ) { try {rs.close(); } catch (SQLException e) {e.printStackTrace();} }
if (stmt != null ) { try {stmt.close(); } catch (SQLException e) {e.printStackTrace();} }
if (conn != null ) { try {conn.close(); } catch (SQLException e) {e.printStackTrace();} }
}
}
見よ、涙の結晶を!! これだけで3時間くらいかかった。

疲れたので、あまり喜べない。。。
とりあえず、tomcat + servlet + jspで mysql、redirectまでは解った!!!
すげーーーーーーーーーーーーーーーー
mysql connectorは鬼門だった。。
さあ~ ansible 行ってみよう♪♪♪♪♪