Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


priti tandel
servlet
1 Answer(s)      a year and 10 months ago
Posted in : Java Server Faces Questions


here is my code.it doesn't work plz help me

import java.io.*; import java.sql.*;

import javax.servlet.*; import javax.servlet.http.*;

public class priti1 extends HttpServlet{ int counter = 0; public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { response.setContentType("text/html"); PrintWriter pw = response.getWriter(); counter++; Connection con; Statement st;

try{ Class.forName("org.gjt.mm.mysql.Driver").newInstance(); pw.println("successful"); pw.println("At present the value of this counter is " + counter +"tiesore");

con=DriverManager.getConnection("jdbc:mysql://localhost/priti","root","pritishine"); System.out.println("connection"); st=con.createStatement(); st.executeQuery("use priti"); st.executeUpdate("insert into emp_sal values('uiu',89)"); pw.println("succes"); con.close(); } catch(Exception e){ System.out.println(e); }

} }


Advertisement
View Answers

October 10, 2012 at 11:01 PM


hi, u give query like as bellow.

"insert into emp_sal values("+'uiu'+","+'88'+")"



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com