954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQL insert problem

<%

	String UN=request.getParameter("un");
	String pw=request.getParameter("pw");
	String FN=request.getParameter("FN");
	String LN=request.getParameter("LN");
	String L1=request.getParameter("L1");
	String L2=request.getParameter("L2");
	String L3=request.getParameter("L3");
	String ccn=request.getParameter("ccn");
	
	
	Class.forName("com.mysql.jdbc.Driver").newInstance();
	java.sql.Connection myConn;
	myConn = DriverManager.getConnection
	("jdbc:mysql://localhost:3306/train_resev","root", "3866" );
	
	PreparedStatement ps=myConn.prepareStatement("insert into user values('" + un + "','" + pw + "','" + FN + "','" + LN + "','" + L1 + "','" + L2 + "','" + L3 + "','" + ccn + "')");
		
	ps.executeUpdate();
	
	ps.close();
	myConn.close();
	

	
%>


i get this error
what to do??

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 23 in the jsp file: /My Web Sites/processregister.jsp
un cannot be resolved
20: 	myConn = DriverManager.getConnection
21: 	("jdbc:mysql://localhost:3306/train_resev","root", "3866" );
22: 	
23: 	PreparedStatement ps=myConn.prepareStatement("insert into user values('" + un + "','" + pw + "','" + FN + "','" + LN + "','" + L1 + "','" + L2 + "','" + L3 + "','" + ccn + "')");
24: 		
25: 	ps.executeUpdate();
26:

plzz help

y2kshane
Light Poster
35 posts since Aug 2010
Reputation Points: 8
Solved Threads: 0
 

since " is a special character you have to use as \" . remember in any programing language we can not use directly these special character so whenever you want to use this or any other character to compile , you always have to use with \ (slash)

pushkar honey
Newbie Poster
13 posts since Feb 2008
Reputation Points: 6
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: