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



Home Answers Viewqa JDBC MS ACCESS
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


shivanand42
MS ACCESS
0 Answer(s)      a year and 11 months ago
Posted in : JDBC


i have done : Insert form data into MS database

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 server and run your jsp/servlet code

and created a table with fields: my : username(text data type) lastname(text) email(text) reemail(text) newpass(text) gender(text) and dob(text)

REGISTER.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- used jquery for datepicker -->

 <meta charset="utf-8" />    <title>register</title>    <link rel="stylesheet" href="css/jquery-ui[1].css" />    <script src="script/jquery-1.8.2.js"></script>    <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>    <link rel="stylesheet" href="/resources/demos/style.css" />    <script>    $(function() {        $( "#datepicker" ).datepicker();    });    </script>

</head>
<body background="images/register.bmp">
<div id="container" style="height:500px;width:500px">

<div id="login" style="background-color:#FAEBD7;height:500px;width:350px;float:left;">
<center><h2><i><b>Registration</b></i></h2></center>
<table>
<tr>
<td><b><i>Username</i></b></td>
<td><input type="text" size="15" maxlength="30" name="username" /></td>
</tr>
<tr>
<td ><b><i>Last Name</i></b></td>
<td><input type="text" size="15" maxlength="30" name="lastname" ></td>
</tr>
<tr>
<td ><b><i>Email</i></b></td>
<td><input type="text" size="15" maxlength="30" name="email" ></td>
</tr>
<tr>
<td ><b><i>Re-enter Email</i></b></td>
<td><input type="text" size="15" maxlength="30" name="reemail" ></td>
</tr>
<tr>
<td ><b><i>New Password</i></b></td>
<td><input type="password" size="15" maxlength="30" name="newpass" ></td>
</tr>
<tr>
<td ><b><i>Gender</i></b></td>

<td><select name="gender">
  <option value="male">male</option>
  <option value="female">female</option>

</select></td>

</tr>


<tr>
<td ><b><i>DOB</i></b></td>
<td>
<input type="text" id="datepicker" name="datepicker" />
</td>
</tr>


<tr>
 <form action="./Registartion" method="post">


            <input type="submit" value="SINGUP"></input>
        </form>

        <!--  <td><INPUT TYPE="button" VALUE="SIGNUP" onClick="parent.location='page1.html'"></td>-->

</tr>
</table>
</div>
</div>
</body>
</html>


REGISTRATION.JAVA
package validate;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
/**
 * Servlet implementation class Registartion
 */
public class Registartion extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */


    public static String username="";
    public static String lastname="";
    public static String email="";
    public static String reemail="";
    public static String newpass="";
    public static String gender="";
    public static String datepicker="";
    public static void main(String[] args) {
        Connection con = null;
        try {



          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\myca\\demo\\authors.accdb");
    // Creating a database table
          Statement sta = con.createStatement(); 
          int i=sta.executeUpdate("insert into registration (username,lastname,email,reemail,newpass,gender,dob) values('"+username+"','"+lastname+"','"+email+"','"+reemail+"','"+newpass+"','"+gender+"','"+datepicker+"')");
          System.out.println("Data is successfully inserted!");
          sta.close();        

          con.close();        
        } catch (Exception e) {
          System.err.println("Exception: "+e.getMessage());
        }
    // TODO Auto-generated constructor stub
    }


    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
         username=request.getParameter("username");
         lastname=request.getParameter("lastname");
         email=request.getParameter("email");
         reemail=request.getParameter("reemail");
         newpass=request.getParameter("newpass");
         gender=request.getParameter("gender");
         datepicker=request.getParameter("datepicker");

    }


    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

}

when i give data in register.jsp data is transferred into registration.java but i couldNOT get data displayed in table in my database (authors.accdb) when i run my registration.java , i got errror saying "EXCEPTION: GENERAL ERROR" PLEASE HELP , DONT GIVE AN EXAMPLE FOR PLEASE SOLVE MY PROGRAM . WHATS REALLY GOIGN WRONG .......WHY I CANT INSERT INTO TABLE (AUTHORS.ACCDB)

IF U GIVE ANY EXAMPLE PLEASE I NEED , IT HAS DROPS AND DATEPICKER IN IT...DONT JUST FOR TEXT BOXES..PEASE ITS REQUEST EVEN IN THE TABLE "USERNAME IS PREIMARY KEY " HELP ME ...I KNOW CONNECTION (MA ACCESS) LET ME KNOW IN MY PROGRAM WHERE I AM GOIN WRONG PLEASE


Advertisement
View Answers

Related Tutorials/Questions & Answers:
ms access
ms access  how to delete the autonumber from ms access using java delete code
MS access
MS access  how do i access my Ms-Access file placed in the same jar file where my application code/class file r present??? Want to access it via Code. Can anyone help me ? Please give reply urgent...   give me reply
Advertisements
Ms Access
Ms Access   How to get query for Primary key from MsAccess?   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name = 'data';   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN
MS-Access
MS-Access  I am trying to upload a image to ms-acess using jsp,and my problem is that it shows some error int the browser that "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect ".I think i set
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access... = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access... = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database Follow...-> data sources. 2)Click Add button and select the driver Microsoft Access... = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb
Jdbc MS-Access question
Jdbc MS-Access question  How to delete records from the three table in MS-Access? They are in relationship with each other regarding to data field
Jdbc MS-Access question
Jdbc MS-Access question  How to delete records from the three table in MS-Access? They are in relationship with each other regarding to data field
How to Access MS Access in jar.
How to Access MS Access in jar.  how do i access my Ms-Access file... to access it via Code or is their any alter-native?? Do i need any Driver to do this ... i m able to access a Ms-access via JDBC but cant find the file wen
MS Access` - IDE Questions
MS Access`  hello sir, how to configure MS Access database in Net Beans5.5... and i have a doubt, where should we run the below code...either in IDE or in any editor like EDITPLUS. waitin for your reply.... thank you
J2ME connectivity to ms access
J2ME connectivity to ms access  How to establish client server connectivity to access ms access database on the server side? I have made the odbc connection. Plz help me in the coding part.. Dont know how to start
MS ACCESS - JDBC
MS ACCESS  java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'origin='src' destination='dest''. THAT MY PROBLEM
MS Access` - JDBC
MS Access`  Hello Sir, Thank you very much for your valuable information. Actually i am doin a project to generate Hall tickets.So, I need to insert image into MS Access Database. Now the task is how to retrieve the image
excel to ms access
excel to ms access  hello sir i am developing a application which requires extracting data from excel sheet and place in the ms access database using java programming for example: in excel sheet i have 2 columns and more than
MS Access - JSP-Servlet
stepts 1.to configure the ms access database to your system control panel... in Connectivity in MS Access : import java.sql.*; public class...MS Access  hello sir, i want to use MS.Access as my database..so my
inserting picture in ms access
inserting picture in ms access  hi i am sanatan, how to insert picture in ms access by jsp.   <%@page import="java.sql.*,java.io.*"%> <% try{ InputStream sImage; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
MS Access - JDBC
information about MS access database...but still i am having doubt in that topic. My problem is : Is there any jar to connect MS Access and java ... because... to be remember 1.to configure the ms access database to your system control
MS Access - WebSevices
MS Access  hello sir, i am trying to write a code which should take images from a particular folder and data from MSAccess..please help me..thank..." which have access database and for images we have created a field in the table
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
Dialect for MS Access - Hibernate
Dialect for MS Access  Can someone tell the Dialect for MSAccess.I need it urgently Thanks in advance
java &ms access - JDBC
java &ms access  Seasons Greetings, Am, creating an application for a food festival using Java swing as front end and MS access as Backend... ve managed to populate the JComboBox using MS Access. The problem is only 8 per
Upload file to MS Access
Upload file to MS Access  Iam beginner and need to upload file to msaccess using jsp . Iam using netbeans platform. Kindly explain do I need to mention Attachment format in the table
Migrating from mysql to MS Access
Migrating from mysql to MS Access  Hi I am hoping for some help I need to write a conversion program (SQL statements) to import existing data in a MYSQL database to a MS Access database. any suggestions would be appreciated
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
accessing ms access through jsp
accessing ms access through jsp  i have 3 tables in my database employee,project,task if i put employee id the search field .i should get details from other table what all queries should i use in servlet file and i am using
How to use JTable with MS-Access
How to use JTable with MS-Access   I have Three Column in Database (MS-Access). 1. Name 2. City 3. Contact I want to Display....   Here is an example that retrieves the data from MS Access database
 

 

 

DMCA.com