cannot insert data into ms access database

Ads

 
 
 

Share on Google+Share on Google+

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

<[email protected] 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>
Ads
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:

<[email protected] 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

Ads









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
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.. <[email protected]
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  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
Tutorials   
Java Spring Hibernate Struts Training i have an ques. of advanced java commandlink tag in primefaces needs onclick effect how can i run ASP.Net Server from netbeans IDE? java code for cursor java vertual machine launcher error; cannot access jarfiles JSF Tutorial render in input typetext java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener After authentication and connection establishment, Upload a zipfile by chunks in java JSF CONNECTION WITH MICROSOFT ACCESS Download Current Web Page As PDF java servlet dropdown list in jsf panelGrid header do the following how to make drop down list in JSF & fetch data Item from database help me please doubt regarding JSF Creating Dynamic Tree How to upload zip file from android to server programmatically????? jsf application war file not running in my jboss 6.0 on linux 5.5 Business analysis servlet servlet exception in thread main while running servlet How to get browser time zone? JAVA Socket Programming excel report fro jsp mysql Redirect to same jsp page on successful login jsf f:parm value dynamical settings jsf f:parm value dynamical settings RMI Program in netbeans pagination in jsf pagination jsf pagination How create csv format in jsf ? need JSP Code. Arrays, loops and string handling unique value renderer JSF 1.2 online tutorial JSF code JSP jps Multicast under UDP(client server application) How to rectify "Bad version number in .class file" exception in Eclipse about avl tree and hashing project on avl tree and hashing How to navigate from one jsf to another in eclipse how to focus on the new window opened from JSF ? Editing UI components using managed bean

Ads

 
Advertisement null

Ads