servlet problem - Mailing list pgsql-jdbc

From senthil kumar
Subject servlet problem
Date
Msg-id 20020509060012.312DB4758EC@postgresql.org
Whole thread Raw
List pgsql-jdbc
Dear Sir/Madam,
     Below i have written my environment
   installed FreeBSD 4.5
   installed JDK1.3.1
   installed Tomcat 3.2
   installed Postgresql 7.2.1
   installed JDBC-Postgre driver and placed the pgjdbc.jar file in
/jdk1.3.1/jre/lib/ext
 servlet.jar file was located in /usr/local/tomcat/lib/servlet.jar

i am the beginer for the java world and postgresql.i don`t know how to
compile and run the below servlet program
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class Mypsql extends HttpServlet {
   Connection conn;
   Statement stmt;

  //set the connection url,database username and password
  String url = "jdbc:postgresql://localhost:5432/postgres";
  String dbusername = "postgres";
  String dbpass = "postgres";

  public void init(ServletConfig config)throws ServletException{
   super.init(config);
  }

  public void doGet(HttpServletRequest req, HttpServletResponse res)throws
   ServletException, IOException{
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();

   try
    {
      Class.forName("org.postgresql.Driver");
      conn = DriverManager.getConnection(url,dbusername, dbpass);

      stmt = conn.createStatement();

      ResultSet rs = stmt.executeQuery("SELECT*FROM test1");

      while(rs.next())
      {
         out.println(rs.getString(1)+ "<BR>");
      }
     }
    catch(Exception e)
    {
      out.println(e);
    }
}
}




 i couldn`t find postgresql.jar file.
     please any one help me !
       Thanks in advance!
            kumar



pgsql-jdbc by date:

Previous
From: Ron Snyder
Date:
Subject: Re: Logging function calls to figure out lo_close log entr
Next
From: "Thomas De Vos"
Date:
Subject: Re: Encoding