Share on Google+Share on Google+

1 Answer(s)      6 years and 10 months ago
Posted in : JDBC
code for front-end of any JDBC compatible database


View Answers

June 8, 2010 at 11:30 AM

Hi Friend,

Try the following code:


<center><h3>Registration Form</h3></center>
<form method="get" action="Registration.jsp">
<tr><td>First Name:</td><td><input type="text" name="firstname" size="20"></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="lastname" size="20"></td></tr>
<tr><td>User Name:</td><td><input type="text" name="username" size="20"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" size="20"></td></tr>
<tr><td>Address </td><td><input type="text" name="address" size="20"></td></tr>
<tr><td>Contact No </td><td><input type="text" name="contact" size="20"></td></tr>
<tr><td>Email: </td><td><input type="text" name="email" size="20"></td></tr>
<tr><td>City: </td><td><input type="text" name="city" size="20"></td></tr>
<tr><td>State: </td><td><input type="text" name="state" size="20"></td></tr>
<tr><td>Country: </td><td> <input type="text" name="country" size="20"></td></tr>
<tr><td><input type="submit" value="Submit" name="B1"></td><td><input type="reset" value="Reset" name="B2"></td></tr>


<[email protected] import="java.sql.*" %>
String fname= request.getParameter("firstname");
String lname= request.getParameter("lastname");
String uname= request.getParameter("username");
String pass= request.getParameter("password");
String address= request.getParameter("address");
String contact=request.getParameter("contact");
String email=request.getParameter("email");
String city=request.getParameter("city");
String state=request.getParameter("state");
String country=request.getParameter("country");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root";, "root");
Statement st=conn.createStatement();
int i=st.executeUpdate("insert into employee(firstname,lastname,username,password,email,address, contactNo,city,state,country) values ('"+fname+"','"+lname+"','"+uname+"','"+pass+"','"+email+"','"+address+"','"+contact+"','"+city+"','"+state+"','"+country+"')");
out.println("Data is successfully inserted");

For the above code, we have created following database table:

CREATE TABLE `employee` (
`userid` bigint(30) NOT NULL auto_increment,
`firstname` varchar(40) default NULL,
`lastname` varchar(40) default NULL,
`username` varchar(40) default NULL,
`password` varchar(40) default NULL,
`email` varchar(100) default NULL,
`address` varchar(255) default NULL,
`contactNo` int(255) default NULL,
`city` varchar(255) default NULL,
`state` varchar(255) default NULL,
`country` varchar(255) default NULL,
PRIMARY KEY (`userid`)


Related Tutorials/Questions & Answers:
project  suggest a network security project based on core java with explanation
PROJECT  i want online polling system project codding
project  i need a project in java backend sql
project  sir i want a java major project in railway reservation plz help me and give a project source code with entire validation thank you
project  sir i want module and source code on my project hospital management system
project  does hostel management system project contain any dynamic web pages
PROJECT  i want help on making project on mobile banking application..... the application should have SAVING ACCOUNT,CURRENT ACCOUNT,TRANSACTION ETC......... IN APPLICATION
project  i have to do my final year project project topic:Weekly Automatic College Timetable Generation System BRIEF EXPLANATION ABOUT PROJECT This project takes various inputs from the user such as Teacher List, Course List
project  sir i want to a project on railway reservation,sir plz give me the source code   plz give me the source code of railway reservation
project   hi , we r working on one project related to our results. we using java and for back end sqlserver 2005. In dis we are trying to retrieve result from some site and store it in our data base so that we can perform
project  For my project their is 2 users, one is users and administers.i want code for giving authentication to these users by using one, means same login form and database table back end is mysgl....and am using wamp sever
Project  Hi, Am starting a new project to draw a 2d graph using java swing and opengl,where in the input for X-axis and Y-axis co=ordinates should be accepted from user... As am very new to this am seeking help so pls help
project..  Write a program to find the result of N students by accepting 5-subject marks from a Mark class and calculate the total and average mark. Display the result of all students in ascending order of rank from Result class
Project  &lt;% String project no=request.getParameter("project no"); String qry="select stud name,project name,project type,project...(receipt dt,'dd/mm/yyyy') from proj master "; qry+=" where project
project  I'm designing a netbeans java program/project. I have to design a program that captures the persons name and mark #.then find the average mark of the whole class.after that need to count and display who had the highest
project...   enter 10 integers, store it using array then display them from highest to lowest. 2.enter 10 integers, store it using array then display them from lowest to highest number to words conversion create a java program
Project  How to show Questions randomly so that no two student get the same questions in online examination system project in Java Server Pages  
=(String) vdata.get(1); String project_name=(String) vdata.get(2); String project
project enquire
project enquire  **hi admin, are you had project about "project tracking" on java
Project Management
Project Management  What is Project Management and how it useful in managing a software project. What all certification courses are available for Software Project Management? How to become a good project manager? Thanks
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
project query
project query  I am doing project in java using eclipse..My project is a web related one.In this how to set sms alert using Jsp code. pls help me
mini project
mini project  I want a mini project on eco tourism
Project Doubght
Project Doubght  What is meant by server monitoring in java enterprise application
Need Project
Need Project  How to develop School management project by using Struts Framework? Please give me suggestion and sample examples for my project
[Mini-Project]  [Mini-Project] Develop a programmer's editor in Java that supports syntax highlighting, compilation support, debugging support, etc
java project
java project  i would like to get an idea of how to do a project by doing a project(hospital management) in could you please provide me with tips,UML,source code,or links of already completed project with documentation
Project in jsp
Project in jsp  Hi, I'm doing MCA n have to do a project 'Attendance Consolidation' in JSP.I know basic java, but new to jsp. Is there any JSP source code available for reference...? pls help me
Java Project
Java Project  Java project using with collection and generic with observer design pattern
project description
project description  Hi Sir, i want to ask question how to describe web project in interview. i did work on some project and role was the application development such as (login,register validation etc)and time of project was 3
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu


Advertisement null