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 it? Please tell what needs to be done after creating a table with an example.

View Answers

December 23, 2010 at 11:33 AM

Hello Friend,

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 code.

Here is your required code:

<%@page import="java.sql.*"%>
<table border=1>
<tr><th>Name</th><th>Address</th></tr>

<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from data");
while(rs.next()){
    %>
<tr><td><%=rs.getString("name")%></td><td><%=rs.getString("address")%></t

d></tr>
<%
}
rs.close();
st.close();
con.close();
}
catch(Exception e){}
%>
</table>

where student is our DSN.

Thanks


March 25, 2012 at 8:52 AM

hi friend thanks a lot for the code. its working .









Related Tutorials/Questions & Answers:
How To Connect MS ACCESS 2003 Database in C Program with Graphics.
how to connect to MS access database in JSP?
Advertisements
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java - Java Beginners
link hibernate to MS ACCESS database
Connect database in Access to Netbean?
how to connect java with ms access using odbc in eclipse
How to Open Picture From M.S. Access Database using Java Servlet ?
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to Access MS Access in jar.
How To Insert A New Record to MS Access table database in GUI
how to delete specified coloumn from database(MS Access) by using windows application
how to store image file and videofile in ms access database using java? - JDBC
How to insert or delete records in MS access database using jsp - JSP-Servlet
how to insert values from jsp into ms access
to get picture from ms access database by jsp-servlet....
JSP1
JSP2
Protect JSPs from direct access
How To Display both image and data into Swing JTable which is retrieved from ms access database
How to use JTable with MS-Access
How to use JTable with MS-Access
applet connected to table in MS Access database
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
ms access
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
HTML(Registration form) to Jsp to stored into MS ACCESS database
MS Access connct using flex with java
MS access
How to connect with database
MS Access - JSP-Servlet
Updating Ms Access Database using jsp - JSP-Servlet
cannot insert data into ms access database - Java Server Faces Questions
Ms Access
how to connect program to database
J2ME connectivity to ms access
MS Access` - IDE Questions
Connect to the database
How to create and Attach MS Access Reports and Crystal Reorts in Java. - Java Beginners
MS Access` - JDBC
MS-Access
Jdbc MS-Access question
Jdbc MS-Access question
MS ACCESS
MS ACCESS
MS ACCESS
how to access database in applet
ms access
ms access
ms access

Ads