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



Home Answers Viewqa JSF-Questions cannot insert data into ms access database

Have Programming Question? Ask it here!
 
 
 


mx
cannot insert data into ms access database
1 Answer(s)      3 years and 9 months ago
Posted in : Java Server Faces Questions



<%@page import="java.sql.*"%>
<html>
<body bgcolor="pink">

<%
String user=request.getParameter("username");
String pass=request.getParameter("password");
String a=request.getParameter("nam");
String a1=request.getParameter("nos");
String a2=request.getParameter("elg");
Connection con=null;
Statement stmt=null;
ResultSet rs=null;

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("Jdbc:Odbc:Data405");
stmt=con.createStatement( );
stmt.executeUpdate("insert into stud(username,password,nam,nos,elg)

values('"+user+"','"+pass+"','"+a+"','"+a1+"','"+a2+"')");

out.println("File inserted");
}
catch(Exception e)
{
out.println("error");
}
con.close();
%>
<a href="http://localhost:8080/maya/login1.jsp">go back</a>
</body>
</html>

Advertisement
View Answers

October 5, 2010 at 12:31 PM


Hi Friend,

You can use the following steps for creating DSN connection:

1. Open Data Sources (Start->Control Panel->Administrative Tool->Data Sources(ODBC)

2. Open User DSN tab
3. Add a user DSN
4. Select Microsoft Access Driver(*.mdb)
5. Select database name and Create the DSN name (e.g emp)
6. Click "Ok" and then try the JSP.

form.jsp:

<form name="form" method="post" action="insertpersons.jsp">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td><input type="submit" value="Submit"></td></tr>
</form>

insertpersons.jsp:

<%@page import="java.sql.*"%>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =DriverManager.getConnection("jdbc:odbc:access");
Statement st=conn.createStatement();
String name=request.getParameter("name").toString();
String address=request.getParameter("address").toString();
st.executeUpdate("insert into data(name,address) values('"+name+"','"+address+"')");
out.println("Data is inserted successfully");
}
catch(Exception e){}
%>

Thanks


Related Tutorials/Questions & Answers:
cannot insert data into ms access database - Java Server Faces Questions
cannot insert data into ms access database   go back... Microsoft Access Driver(*.mdb) 5. Select database name and Create the DSN name... connection: 1. Open Data Sources (Start->Control Panel->Administrative Tool
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 doing fine with retrieving the data with ResultSet, but I'm stuck
Advertisements
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
How to insert or delete records in MS access database using jsp - JSP-Servlet
How to insert or delete records in MS access database using jsp  Hi friends please provide me a solution that i insert or delete record from a database using java server pages. I used the microsoft access 2003 database. PlZ
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
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 data in JAVA GUI Envi.
Accessing Ms access data in JAVA GUI Envi.  Q.How to insert data into ms access data in java using swing ? Q.How to slove (access denided ("java.lang.RuntimePermission" "accessClassInPackage.sun.jdbc.odbc")" these exception
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 Display both image and data into Swing JTable which is retrieved from ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database  So far this is my code how can i display both image and data from database.. while (rs.next()) { Vector row = new Vector(columns
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
JRadioButton I want Store Information from JRadioButton to MS Access Database, and I...How to Validate JRadioButton and How to Save data from JRadioButton to MS...:access"); PreparedStatement st=con.prepareStatement("insert into names(name,age
applet connected to table in MS Access database
applet connected to table in MS Access database   i have connected my java code with the MS access database and this is my code, can anyone tell me...(); //insert data insertData(); //use precompiled statement to update data
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data
insert and delete data in database
insert and delete data in database  insert and delete data in database from servlets through JDBC   Hi Friend, Please visit the following links: Insert Data Delete Data Thanks
database is connected but not insert the data
database is connected but not insert the data  hi, i am getting connected to database.Retrive the data also but cannot insert the data into database...("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:Driver={Microsoft Access Driver
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... Panel<<Administrative Tools<< data sources. 2)Click Add button
to get picture from ms access database by jsp-servlet....
to get picture from ms access database by jsp-servlet....  I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp
insert data into database
insert data into database  hi,thanks for reply just i am doing... and studentmaster is the database table name. i am using same details. Now give the data into the jsp page that data stored into the database.Here the error
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
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
unable to insert data into database
unable to insert data into database    hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into database based
insert data into database
insert data into database  type Exception report message...)Go to the start->Control Panel->Administrative Tools-> data sources. 2)Click Add button and select the driver Microsoft Access Driver(*.mdb). 3)After
MS-Access
MS-Access  I am trying to upload a image to ms-acess using jsp,and my...: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect ".I think i set... the data type as OLE Object. Is there any suggestion? my code was.. <%@page
ms access
ms access  how to delete the autonumber from ms access using java delete code
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
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
Ms Access
Ms Access   How to get query for Primary key from MsAccess?  ... = 'data';   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name = 'data'; In the above query, data is our table name
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... data displayed in table in my database (authors.accdb) when i run my
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... data displayed in table in my database (authors.accdb) when i run my
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... data displayed in table in my database (authors.accdb) when i run my
HTML(Registration form) to Jsp to stored into MS ACCESS database
HTML(Registration form) to Jsp to stored into MS ACCESS database  i am sending one html file that contain 18 fields these are stored in ms-access database by using jsp code.i want to urgent jsp code. please urgent sir. thank
Updating Ms Access Database using jsp - JSP-Servlet
Updating Ms Access Database using jsp  Hi I am new to jsp and I am trying to update a record in an access database. I only want to update part of the record because the other columns already have data. When I use Update
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
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...=new JComboBox(); JButton b=new JButton("Insert"); try{ Class.forName
To insert maximum number of data in database.
To insert maximum number of data in database.  how to change string data type into clob data type in jsp   Hi Friend, Please visit the following link: http://www.roseindia.net/jdbc/insert-clob-example.shtml Thanks
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` - JDBC
to insert image into MS Access Database. Now the task is how to retrieve the image from database. And i am developing a JFrame to retrieve tha fields from database...MS Access`  Hello Sir, Thank you very much for your valuable
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
insert data in the database using checkbox
insert data in the database using checkbox  i am fetching data from the database using servlet on the jsp page and there is checkbox corresponding... should i insert only checked data into database on submission.   We
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... data thank you
Insert file data into database
Insert file data into database In this section, you will learn how to insert the file data into database. Description of code: Here we have used FileReader.... Now to insert this data into the database, we have established a database
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
 

 

 

DMCA.com