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



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


mx
cannot insert data into ms access database
1 Answer(s)      4 years and 2 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
Advertisements
 

 

 

DMCA.com