•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 455,968 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,739 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: 1055 | 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,625
Reputation:
Rep Power: 12
Solved Threads: 311
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)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
Publilius Syrus
(~100 BC)
LJC - London Java Community, JAVAWUG (Java Web User Group), Coding the Architecture
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- JSP connection to database (JSP)
- HTML - .jsp? (JSP)
- JSP along database (JSP)
- Using Database Content to produce drop down options (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



Hybrid Mode