User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 373,483 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,918 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: 873 | Replies: 1 | Solved
Reply
Join Date: Nov 2007
Posts: 1
Reputation: Bharath15 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Bharath15 Bharath15 is offline Offline
Newbie Poster

Help JSP Database

  #1  
Nov 24th, 2007
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);
}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 1,901
Reputation: peter_budo has a spectacular aura about peter_budo has a spectacular aura about peter_budo has a spectacular aura about 
Rep Power: 9
Solved Threads: 216
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is online now Online
Posting Virtuoso

Re: JSP Database

  #2  
Nov 24th, 2007
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 5:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC