Hi Ajai,
  I have changed the code as per your advice,But currently i am able to getting some error messages in Apache server's log as below:-
      Apache JServ 1.1
            Jserv log file:-
                     [17/03/2000 10:34:09:515 GMT+05:30] java.lang.NullPointerException
 at Hello.doGet(Compiled Code)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
 at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
 at org.apache.jserv.JServConnection.run(JServConnection.java:188)
 at java.lang.Thread.run(Thread.java:479)
 
In Apache group --
  access log as follow:-
                [17/Mar/2000:10:34:09 +0530] "GET /servlet/Hello HTTP/1.0" 200 136
  error log as follow:-
                 problems connecting to

My feeling is that some libary is missing in Apache Server setting ,so can you tell me which is the libary i have include in the Apache server and where i have to add ,what is libary name for jodb-odbc bridge driver.

waiting quick response from you

Thanks
Krishna
 

Ajai Peddapanga wrote:

use try catch while connecting and retrieving data ....u will know where
exactly the problem is ...for example ...
  try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        } catch (Exception e) {
            System.out.println("Failed to load JDBC/ODBC driver.");
            return;
        }

        Statement stmt = null;
        Connection con=null;
        try {
            Connection con =
DriverManager.getConnection("jdbc:odbc:local123","scott","tiger");
            stmt = con.createStatement();
        } catch (Exception e) {
            System.err.println("problems connecting to ");
        }

        try {
           Statement stmt = con.createStatement();

           //Query
           ResultSet rset = stmt.executeQuery("select EMPNAME from EMP1");

           // Iterate through the result and print the employee names
           while(rset.next())
           out.println(rset.getString("EMPNAME"));
           con.close();
           }
         catch (Exception e) {
          e.printStackTrace();
        }
 

Reply via email to