Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How to store user registration details into database(MS Access database), and how to validate the username and password, If again the same person logins.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Gopi
How to store user registration details into database(MS Access database), and how to validate the username and password, If again the same person logins.
2 Answer(s)      2 years and a month ago
Posted in : Java Beginners


Please help me, My Question is -

How to store user registration details into database(MS Access database), and how to validate the username and password, If again the same person logins. Please write the programs in Servlets,JavaBeans and jsp.


Advertisement
View Answers

September 11, 2012 at 5:31 PM


First of all, connect jsp to MS access database. So follow these steps:

1)Go to the start->Control Panel->Administrative Tools-> data sources.

2)Click Add button and select the driver Microsoft Access Driver(*.mdb).

3)After selecting the driver, click finish button.

4)Then give Data Source Name and click ok button.

5)Your DSN will get created.

6) Restart your tomcat server and run your jsp code.

1)form.jsp:

<html>
<head>
<script type="text/javascript">
function check(value){ 
xmlHttp=GetXmlHttpObject()
var url="check.jsp";
url=url+"?name="+value;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
    var showdata = xmlHttp.responseText; 
    alert(showdata);
    document.getElementById("name").value=" ";
    } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try{
  xmlHttp=new XMLHttpRequest();
 }
catch (e) {
 try {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e){
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body>
<form name="form" action="insert.jsp">
<pre>
 UserName: <input  type="text" name="name" id="name" onkeyup="check(this.value);">
 Password: <input  type="password" name="pass" id="pass">
 Address : <input  type="text" name="address" id="address">
 Contact : <input  type="text" name="contact" id="contact">
 Email   : <input  type="text" name="email" id="email">
           <input  type="submit" value="Submit">
 </pre>
</form>    

</body>
</html>

2)check.jsp:

<%@ page import="java.sql.*" %> 
<%
String name = request.getParameter("name").toString();
System.out.println(name);
String data ="";
try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from login where username='"+name+"'");
int count=0;
          while(rs.next())
          {

                   count++;
          }

                    if(count>0)
          {
             data="Not Available";
          }
          else
          {
          }
out.println(data);
System.out.println(data);
}
catch (Exception e) {
System.out.println(e);
}
%>

3)insert.jsp:

<%@page import="java.sql.*"%>
<%
String user=request.getParameter("name");
String pass=request.getParameter("pass");
String address=request.getParameter("address");
String contact=request.getParameter("contact");
String email=request.getParameter("email");


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student","","");

Statement st=con.createStatement();
int i=st.executeUpdate("insert into data(username,password,address,contact,email) values('"+user+"','"+pass+"','"+address+"','"+contact+"','"+email+"')");
out.println("Data is inserted successfully");
%>


September 13, 2012 at 11:10 AM


Hi, Please use servlets, where the Servlet program will store or retrieve the user details. And also use PreparedStament(JDBC) for storing information into database.

By the way.. Thanks for the program and Please do the needful.



Related Tutorials/Questions & Answers:
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  ... import="java.sql.*" %> <% Connection con=null; String user=request.getParameter("userid"); session.putValue("userid",user); String pwd
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  ... import="java.sql.*" %> <% Connection con=null; String user=request.getParameter("userid"); session.putValue("userid",user); String pwd
Advertisements
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  ... import="java.sql.*" %> <% Connection con=null; String user=request.getParameter("userid"); session.putValue("userid",user); String pwd=request.getParameter
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  ... import="java.sql.*" %> <% Connection con=null; String user=request.getParameter("userid"); session.putValue("userid",user); String pwd=request.getParameter
how to check username & password from database using jsp
how to check username & password from database using jsp  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to store JComboBox selected Item into Ms Access Database  How to store JComboBox selected Item into Ms Access Database.  Hi Friend...:access","",""); Statement stmt=con.createStatement(); ResultSet rs
how to store image file and videofile in ms access database using java? - JDBC
how to store image file and videofile in ms access database using java?  how to store image file and video file in ms access database using java
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database  Hello Sir I want Store Corse Type that contains Two JRadioButton I want Store Information from JRadioButton to MS Access Database, and I
validating username and password from database
validating username and password from database  Hello sir, i am developing a login page. i want that when i fill data in text fields. it validate data from database. if enter data is match from database. page goes to next page
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java   how to access the MS ACCESS database with java how can we insert,delete,update,search records of ms access with java   Java MS Access database connectivity Follow
Ajax Registration Program
to validate the user registration through ajax call and then display the alert massage if no values are provided in the username and password fields. When a user input user Id and password and press Register button , method 'call_Register
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
code to validate username password of gmail and procedures to establish jdbc..., 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
code to validate username password of gmail and procedures to establish jdbc..., 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
code to validate username password of gmail and procedures to establish jdbc..., 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
code to validate username password of gmail and procedures to establish jdbc..., 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
code to validate username password of gmail and procedures to establish jdbc..., 1)I am in need of code to establish username and password of gmail 2)code in jsp to validate the username and password of my gmail mentioned above
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database... through the following link How To Store Image Into MySQL Using Java
User Registration Form Using JSP(JspBeans) after that how i can insert in database
User Registration Form Using JSP(JspBeans) after that how i can insert in database   User Registration Form Using JSP(JspBeans) after that how i can insert in database
how to access the MS ACCESS database with java - Java Beginners
how to access the MS ACCESS database with java  how can we insert,delete,update,search records of ms access with java
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
how to connect to MS access database in JSP?
how to connect to MS access database in JSP?  how to connect to MS access database in JSP? Any seetings/drivers need to be set or installed before... and select the driver Microsoft Access Driver(*.mdb). 3)After selecting the driver
How To Connect MS ACCESS 2003 Database in C Program with Graphics.
How To Connect MS ACCESS 2003 Database in C Program with Graphics.  How To Connect MS ACCESS 2003 Database in C Program with Graphics
How to store user name,city,state,image path into database and image into folder using jsp
How to store user name,city,state,image path into database and image into folder using jsp  How to store user name,city,state,image path into database and image into folder using jsp
Write a program to get student details and store in a database
Write a program to get student details and store in a database  Write a program to get student details and store in a database
How can I protect my database password ?
How can I protect my database password ?   How can I protect my database password ? I'm writing a client-side java application that will access..., where the connection string to the database, including user and password, is stored
How to Store Float Value into Access Database - Java Beginners
How to Store Float Value into Access Database  Hello sir,I want to Store Student Marks Percentage into Access Database in Float Value how i can Store.... To store the double value in Access database, you need to set the datatype
How to store JComboBox item into database
How to store JComboBox item into database   import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  Hi all my Friends I have below code which insert a picture into M.S. Access Database But i m still not able to open this picture through Java using M.S. Access
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI  Hello... that involves inserting a record into a 6-column table in my MS Access database table. I'm... on the actionPerformed events. The problem I'm having is that when the user clicks
how to create a user registration form in php
how to create a user registration form in php  how to create a user registration form in php
user registration
user registration  hi frnds...am working on a project in JSP.i want to create a user registration form with username,password,mail id and check box... it in Ms Access database for admin purpose.pls help me with this coding guys
Advertisements
 

 

 

DMCA.com