While replying click on "Reply All" so that it is respond to the group I did not ask this question.
On Thu, Mar 19, 2009 at 12:53 AM, Chandra Bhanu Verma <chandrabhanu.ve...@utitsl.co.in> wrote: > Hello dear friend, > > > > > > Correct following things in give code: > > > > Before changing in code you have to do following steps to check mySQL > library file added or not : > > > > Go to property of project and cilck on library whether jar file > “mysql-connector-java-3.1.11-bin.jar” added or not if not then first > attached that. > > > > Then check code for following changes. > > > > 1. Class.forName("com.mysql.jdbc.Driver").newInstance(); > > 2. Connection con= > DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb","userid","pass"); > > > > Check with above steps. > > > > > > > > > > > > > > > > > > ________________________________ > > From: java-ee-j2ee-programming-with-passion@googlegroups.com > [mailto:java-ee-j2ee-programming-with-pass...@googlegroups.com] On Behalf Of > Fernando Abreu > Sent: Wednesday, March 18, 2009 9:56 PM > To: talk2manj...@gmail.com > Cc: fiveholida...@hotmail.com; kiran.billap...@gmail.com; > java-ee-j2ee-programming-with-passion@googlegroups.com; kiran. b333 > Subject: [java ee programming] Re: please tell the solution urgently > > > > I don't know if it is the major problem but check on your code : > > > > 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"); > > > > What happens if you change to: > > > > String durl="jdbc:mysql://localhost:3306/mydb/"; > > or > > String durl="jdbc:mysql://localhost:3306/mydb"; > > > > It does not sound a great solution, but I got stuck in a " / " (forward > slash) I forgot in an application in the past, and that drove me nuts. > > > > Fernando > > > > > > On Tue, Mar 17, 2009 at 2:28 PM, Manjula Srinivas <talk2manj...@gmail.com> > wrote: > > 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> >> >> } >> >> > >> > > > > > -- > > > > Fernando Abreu > fxab...@gmail.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---