•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,616 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,679 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 13077 | Replies: 4
hi
i am trying to insert into mysql databse using jsp.but i am getting the error as
^
my code is
<%
String usercode=request.getParameter("usercode");
session.setAttribute( "theuser", usercode );
String password =request.getParameter("password");
session.setAttribute( "thepass", password );
String email=request.getParameter("email");
session.setAttribute( "theemail", email );
String name=request.getParameter("name");
session.setAttribute( "thename", name );
String phone=request.getParameter("phone");
session.setAttribute( "thephone", phone );
String add1=request.getParameter("address1");
String add2=request.getParameter("address2");
String add3=request.getParameter("address3");
String add4=request.getParameter("address4");
String country=request.getParameter("country");
%>
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost/login?user=user ;password=pass";
%>
<html><body>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(connectionURL, "", "");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeUpdate("insert into havyak(usercode,password,email,name,phone,add1,add2,add3,add4,country) values('" + usercode + "','" + password + "','" +
email + "','" + name + "','" + phone + "','" + add1 + "','" + add2 + "','" + add3 + "','" + add4 + "','" + country + "')");
%>
submitted
</body></html>
i am trying to insert into mysql databse using jsp.but i am getting the error as
An error occured between lines: 38 and 47 in the jsp file: /jsp/havyaka/register.jsp
Generated servlet error:
C:\tomcat\work\localhost\examples\jsp\havyaka\register$jsp.java:102: Incompatible type for declaration. Can't convert int to java.sql.ResultSet.
ResultSet rs = statement.executeUpdate("insert into havyak(usercode,password,email,name,phone,add1,add2,add3,add4,country) values('" + usercode + "','" + password + "','" + email + "','" + name + "','" + phone + "','" + add1 + "','" + add2 + "','" + add3 + "','" + add4 + "','" + country + "')");my code is
<%
String usercode=request.getParameter("usercode");
session.setAttribute( "theuser", usercode );
String password =request.getParameter("password");
session.setAttribute( "thepass", password );
String email=request.getParameter("email");
session.setAttribute( "theemail", email );
String name=request.getParameter("name");
session.setAttribute( "thename", name );
String phone=request.getParameter("phone");
session.setAttribute( "thephone", phone );
String add1=request.getParameter("address1");
String add2=request.getParameter("address2");
String add3=request.getParameter("address3");
String add4=request.getParameter("address4");
String country=request.getParameter("country");
%>
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost/login?user=user ;password=pass";
%>
<html><body>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(connectionURL, "", "");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeUpdate("insert into havyak(usercode,password,email,name,phone,add1,add2,add3,add4,country) values('" + usercode + "','" + password + "','" +
email + "','" + name + "','" + phone + "','" + add1 + "','" + add2 + "','" + add3 + "','" + add4 + "','" + country + "')");
%>
submitted
</body></html>
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
- How insert image into mysql database and retrieve (PHP)
- Why does it insert NULL values into MySQL DB??? (ASP.NET)
- how deposit a picture to MYSQL database (PHP)
- dynamically generated textboxes & radio buttons php, insert into db (PHP)
Other Threads in the JSP Forum
- Previous Thread: Problem with update data to database
- Next Thread: Find JSP Model II tutorials



Threaded Mode