why this simple method does't work?
hi guys, could you tell me why this servlet does't work?
import java.io.*;
import java.sql.*;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.sql.*;
publicclass sqlextends HttpServlet{
static Connection getSimpleConnection(){
Connection result =null;
try{Class.forName("com.mysql.jdbc.Driver").newInstance();}
catch (Exception ex){System.err.println("Check classpath. Cannot load db driver: ");}
try{result = DriverManager.getConnection("jdbc:mysql://localhost:3306/zuak","user","pasw");}
catch (SQLException e){System.err.println("Driver loaded, but cannot connect to db: ");}
return result;
}
publicvoid doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
{
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
String st ="36";
String query ="SELECT * FROM data where id=?";
try{
Connection con = getSimpleConnection();
PreparedStatement ps = con.prepareStatement(query);
ps.setString(1, st);
ResultSet rs = ps.executeQuery();
while (rs.next()){
String type = rs.getString("type");
String parent_id = rs.getString("parent_id");
String name = rs.getString("name");
String idd =rs.getString("id");
out.println(type+", "+name+" ,"+idd+". ");
}
}
catch (Exception e){out.println(e);}
}
}
thanks a lot

