Hi, I am new to servlets and I am using javawebserver2.0. I have written a program which si going to use the database wich is in mycase a text file and I am trying to use the database abut I am not being able to. The program is getting compiled but when I try to run it is showing a 501 error. I am attaching the program alongwith.I need urgent help on this. thankximport java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.text.*; public class ServletA extends HttpServlet { Connection dbcon; public void init() throws ServletException { try { String driver = getInitParameter("JdbcDriver"); String dbURL = getInitParameter("dbURL"); Class.forName(driver); dbcon = DriverManager.getConnection(dbURL,"",""); } catch (ClassNotFoundException e) { System.out.println("DB Driver not found"); System.out.println(e.toString()); throw new UnavailableException(this, "DB Driver class"); } catch (SQLException e) { System.out.println("Error in connect"); System.out.println(e.toString()); throw new UnavailableException(this, "Cannot connect"); } }
Hi, You have mentioned that you are using text database file for your program, then how come you are trying to make a connectivity to a database server. what is your JdbcDriver & dbURL ?? If you are using Windpws 98 with Access data base , Are you defining DSN for your mdb files. solaiappan