Even I agree with Evans reply, Kiran please check whether the driver is configured properly.
On Tue, Mar 17, 2009 at 11:25 AM, Evans <fiveholida...@hotmail.com> wrote: > Thanks for telling us about your problem. But what you didn't tell us > however,�was the error message. > > Anyway, make sure you have the driver installed before you can use it. But > if you think you have it installed but still not able to run your code, it > might help by posting the error message you received. > > Good luck > > -- > Evans > http://www.javawug.org > > > ----- Original Message ----- > From: Kiran Kumar > To: java-ee-j2ee-programming-with-passion@googlegroups.com ; kiran. b333 > Sent: Tuesday, March 17, 2009 5:30 PM > Subject: [java ee programming] please tell the solution urgently > hi, > > �i have created jsp login page and servlet(with database connection) in > netbeans 6.5. in servlet file i specified > Class.forname(com.mysql.jdbc.Driver). whenever i click submit button, this > servlet has to be executed. but the above command is not executed. unless it > executes, i cannot work with database. so please find out the error in it. > DUE TO THIS ERROR MY ACADAMIC PROJECT WAS STOPPED.PLEASE HELP ME. > > ������������������� THANK U IN ADVANCE > > > JSP FILE > > > <%...@page contentType="text/html" pageEncoding="UTF-8"%> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > �� "http://www.w3.org/TR/html4/loose.dtd"> > > <html> > ��� <head> > ������� <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> > ������� <title>JSP Page</title> > ��� </head> > ��� <body><form action="servlet2" method="get" > > ������� <center> > > ����������� <label for="name"> user name: </label> > ����������� <input type="text" value="" name="username"> > ����������� <br> > ����������� <label for="PASSWORD"> password: </label> > ����������� <input type="text" value="" name="password"> > ������������� <br> > ������������ <input type="submit" value="submit" > > ����������� </center> > ��� </form> > ��� </body> > </html> > > > SERVLET > > > import java.io.*; > import java.sql.*; > import javax.servlet.*; > import javax.servlet.http.HttpServlet; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > > public class servlet2 extends HttpServlet { > > > ��� @Override > ��� protected void doGet(HttpServletRequest request, HttpServletResponse > response) > �throws ServletException, IOException{ > ������� String str1=request.getParameter("username"); > ������� String str2=request.getParameter("password"); > ������ PrintWriter pw=response.getWriter(); > ������� response.setContentType("text/html"); > ������� pw.println("enter try"); > ������� try{ > ���������� pw.println("entered try"); > ���������� Class.forName("com.mysql.jdbc.Driver"); > ���������� pw.println("enter for name"); > ���������� pw.print("url"); > ��������� String durl="jdbc:mysql://localhost:3306/mydb?"; > �������� String userid="root"; > �������� String pass="root"; > �������� Connection con=DriverManager.getConnection(durl, userid, pass); > ��������������� pw.print("con complete"); > > ������� Statement stmt=con.createStatement(); > ������� ResultSet rs=stmt.executeQuery("select * from mydb.login;"); > > ������� pw.println("<html>"); > ������� pw.print("<body >"); > ������� pw.print("<br>"+"output stopped"+"<br>"); > ������� pw.print("<br>"+"user name is "+str1+"<br>"); > ������� pw.println("password is"+str2+"<br>"); > ������� pw.println("<br>"+"this is servlet output"); > ������� pw.print("this is database"); > ������� while(rs.next()) > ������� { > ������� pw.print(rs.getString(1)+"<br>"); > ������� pw.print(rs.getString(2)+"<br>"); > > ������� } > ������� pw.println(" </body >"); > ������� pw.println("</html>"); > ������� } > ������� catch(Exception e) > ������� { > ����������� System.out.print("error occured"); > ������� } > ��� } > > ��� @Override > ��� protected void doPost(HttpServletRequest request, HttpServletResponse > response) > ��� throws ServletException, IOException { > ������� //processRequest(request, response); > ��� } > > ��� @Override > ��� public String getServletInfo() { > ������� return "Short description"; > ��� }// </editor-fold> > > } > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en -~----------~----~----~----~------~----~------~--~---