I commented some of the code to check the connectivity with the database (instead of initializing from the descriptor file).
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet
{
Connection dbConnection;
/*public void init()
{
//ServletConfig config=getServletConfig();
//System.out.println(getServletName()+":Initializing...");
//String driverClassName=config.getInitParameter("driverclassname");
//String dbURL=config.getInitParameter("dburl");
//String username=config.getInitParameter("username");
//String password=config.getInitParameter("password");
/*try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException e){System.out.print("beep");}
/* try
{
dbConnection=DriverManager.getConnection("jdbc
dbc
b1","hello","welcome");
}catch(SQLException e){}
System.out.println("Initialized");*/
//}
public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
PrintWriter pw=res.getWriter();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbConnection=DriverManager.getConnection("jdbc
dbc
D","","");
Statement smt=dbConnection.createStatement();
ResultSet r=smt.executeQuery("SELECT * FROM MySQLODBC");
pw.println("<html>");
pw.println("<body>");
pw.println("<h1>hello</h1>");
while(r.next())
{
int j=r.getInt("ID");
String s = r.getString("name");
int i = r.getInt("age");
pw.println("ROW = "+j+" " + s + " " + i);
}
pw.println("</body>");
pw.println("</html>");
smt.close();
dbConnection.close();
}
catch(Exception e)
{
pw.println("<html>");
pw.println("<h1>"+e+"no result</h1>");
pw.println("</html>");
}
}
}