hi Rajan,
Here is the piece of code which will show you how to use thin drivers for
servlet.This is
public void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
resp.setContentType("text/html");
PrintWriter out =3D new PrintWriter(resp.getOutputStream());
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con;
con =3D
DriverManager.getConnection("jdbc:oracle:thin:@199.230.20.245:1521:test1"
,"username","password");
/* above ip address is your oracle machine ip address and test1 is your
datbase name or SID name */
System.out.println(con);
Statement stmt =3D con.createStatement();
ResultSet rs =3D stmt.executeQuery("select * from products");
out.println("<HTML>");
out.println("<HEAD><TITLE>db_servet output</TITLE></HEAD>");
out.println("<BODY>");
while(rs.next()){out.println("<br>");
out.println(rs.getString(1));out.println("<br>");
out.println(rs.getString(2));out.println("<br>");
out.println(rs.getString(3));out.println("<br>");
out.println(rs.getString(4));out.println("<br>");
out.println("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D");
}
out.println("</BODY>");
out.println("</HTML>");
out.close();
}
catch(Exception e){
out.print("Falied to fetch data from database ");
}
}
I think this will give you an idea regarding thin drivers.enjoy.....
bye..bye....
vinod
> ---------------------------------------------
> Attachment:=A0
> MIME Type:=A0multipart/alternative
> ---------------------------------------------
Hi Vinod
Thanx for information. But I still have a doubt. Can servlets use
thin drivers. If so can u give me a short example for that
With regards
Rajan Behal