•
•
•
•
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,767 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 3,196 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: 914 | Replies: 1 | Solved
![]() |
•
•
Join Date: Nov 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi can somebody help me i am new to developing. ADD the new record to the existing database table at the end of all rows.Something like registration form details.
<%@page import="java.sql.*" %>
<%
String fisname=request.getParameter("firstname");
String lstname=request.getParameter("lastname");
String sex=request.getParameter("gender");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Bharath");
Statement st=con.createStatement();
DataInputStream din=new DataInputStream(System.in);
while(rs.afterlast())
{
int count=st.executeUpdate("insert into registeredusers values('"+firstname+"','"+lastname+"','"+gender+"')");
if(count>0)
{
out.println("Records Entered Successfully");
}
else
out.println("Insertion Failed");
}
}
catch(Exception e)
{
out.println(e);
}
<%@page import="java.sql.*" %>
<%
String fisname=request.getParameter("firstname");
String lstname=request.getParameter("lastname");
String sex=request.getParameter("gender");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Bharath");
Statement st=con.createStatement();
DataInputStream din=new DataInputStream(System.in);
while(rs.afterlast())
{
int count=st.executeUpdate("insert into registeredusers values('"+firstname+"','"+lastname+"','"+gender+"')");
if(count>0)
{
out.println("Records Entered Successfully");
}
else
out.println("Insertion Failed");
}
}
catch(Exception e)
{
out.println(e);
}
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,137
Reputation:
Rep Power: 10
Solved Threads: 257
Connecting to DB with use of JSP is old fashioned and should not be used any more. So if you wish to interact with DB you should use JSP page with form for data entry, then pass it to servlet that will store data in DB and then to progress to futher action. Data validation can be done on JSP or servlet depends on your requirements and your abilities. For some tutorials you should check Sun website or see these tutorials
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
- HTML - .jsp? (JSP)
- JSP along database (JSP)
- Using Database Content to produce drop down options (JSP)
- JSP connection to database (JSP)
- passing mulitple parameters from jsp to a database (JSP)
Other Threads in the JSP Forum
- Previous Thread: What to do to Become a JSP Evangelist!
- Next Thread: connection with crystal report



Linear Mode