i am experimentally trying to retreive stuff from a database but i am getting an error i cannot figure out.
i attach the
servlet and the error message below.
any and all help is appreciated.
jb
entire servlet:
====
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class country_info_servlet extends HttpServlet {
private Connection dbaseConn = null;
private static PrintWriter out;
private Cookie[] MyCookies;
private
String uid;
private String encrypteduid;
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
dbaseConn = makeConnection();
}
catch (Exception ex) {
log("Sybase Connect Error: "+ex.getMessage());
}
}
private void createpage(String pathInfo) throws Exception {
ResultSet MerchantQuery;
Statement query;
out.println("<html><body>");
out.println("<tr><td width=\"700\" colspan=2><img src="+
"\"http://....m/images/....gif\" width=\"500\" "+
"height=\"108\" alt=\"\"></td></tr>");
out.println("<P><a href=https....com/cgi-bin/payment/checkout.pl>View Shopping Cart "+
"and Checkout</a>");
out.println("<h1>Country Information</h1>");
query = dbaseConn.createStatement();
MerchantQuery = query.executeQuery(
"select country_code,country_name,worldarea from sjcnt");
while (MerchantQuery.next())
{
String country_code = MerchantQuery.getString("country_code");
String country_name = MerchantQuery.getString("country_name");
String worldarea = MerchantQuery.getString("worldarea");
out.println("<h2><a href=\"../servlet/country_info_servlet/"+">"+"CODE: "+country_code+"NAME: "+country_name+"GLOBAL REGION: "+worldarea+"</a></h2>");
}
MerchantQuery = query.executeQuery(
"select merchantnr,name from Merchant m "+
"where exists (select 'X' from MerchantProducts where "+
"merchantnr = m.merchantnr and mart = 'SER')");
while (MerchantQuery.next()) {
String name = MerchantQuery.getString("name");
int merchantnr = MerchantQuery.getInt("merchantnr");
out.println("<h2><a href=\"../servlet/testdb/S"+merchantnr+
"\">"+name+"</a></h2>");
}
query.close();
}
private Connection makeConnection() throws Exception
{
Properties dbaseProps = new Properties();
dbaseProps.put("server", "...SERVER");
dbaseProps.put("db", "M...db");
dbaseProps.put("user", "sa");
dbaseProps.put("password", "....");
dbaseProps.put("SERVICENAME", "...");
String jdbcDriver = "com.sybase.jdbc.SybDriver";
String jdbcUrl = "jdbc:sybase:Tds:...:2500/...db";
Class.forName(jdbcDriver).newInstance();
return DriverManager.getConnection(jdbcUrl, dbaseProps);
}
}
====
I get the following error:
> Error: 400
> HTTP method GET is not supported by this URL
====
[This message has been edited by Jay Brown (edited February 14, 2001).]