P
paul
hi all,
i am new to use servlet, however, i wrote the program below but the
error shown as subject.
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InventoryServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String id = req.getParameter("id");
PrintWriter out = res.getWriter();
try {
// create a connection
Class.forName("com.pointbase.jdbc.jdbcUniversalDriver").newInstance();
String url = "jdbcointbase:server://localhost/mt811";
String uid = "pbpublic";
String pwd = "pbpublic";
Connection Con = DriverManager.getConnection(url, uid, pwd);
Statement stm = Con.createStatement();
String sql = "SELECT * FROM Inventory";
// get the customer info
ResultSet result = stm.executeQuery(sql);
out.println("<html><head><title>tsting</title></head></html>");
out.println("<h2>database</h2>");
while (result.next()) {
// out.println(result.getString("Name"));
// out.println(result.getInt("Quantity"));
out.print(result.getInt("Quantity"));
out.println(result.getString("InventoryID"));
out.println(result.getString("Name"));
}
// Clean up
result.close();
stm.close();
Con.close();
} catch (Exception e) {
out.println(e.toString());}
}
public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException {
doGet(request, response);
}
}
the same driver , login, passwd can be used in another program and
successfully.
pls advise.
paul
i am new to use servlet, however, i wrote the program below but the
error shown as subject.
import java.sql.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InventoryServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String id = req.getParameter("id");
PrintWriter out = res.getWriter();
try {
// create a connection
Class.forName("com.pointbase.jdbc.jdbcUniversalDriver").newInstance();
String url = "jdbcointbase:server://localhost/mt811";
String uid = "pbpublic";
String pwd = "pbpublic";
Connection Con = DriverManager.getConnection(url, uid, pwd);
Statement stm = Con.createStatement();
String sql = "SELECT * FROM Inventory";
// get the customer info
ResultSet result = stm.executeQuery(sql);
out.println("<html><head><title>tsting</title></head></html>");
out.println("<h2>database</h2>");
while (result.next()) {
// out.println(result.getString("Name"));
// out.println(result.getInt("Quantity"));
out.print(result.getInt("Quantity"));
out.println(result.getString("InventoryID"));
out.println(result.getString("Name"));
}
// Clean up
result.close();
stm.close();
Con.close();
} catch (Exception e) {
out.println(e.toString());}
}
public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException {
doGet(request, response);
}
}
the same driver , login, passwd can be used in another program and
successfully.
pls advise.
paul