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 .

Ads









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
Connect database in Access to Netbean?
how to connect java with ms access using odbc in eclipse
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 insert values from jsp into ms access
to get picture from ms access database by jsp-servlet....
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
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
applet connected to table in MS Access database
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
ms access
How to connect with database
JSP1
JSP2
HTML(Registration form) to Jsp to stored into MS ACCESS database
MS Access connct using flex with java
how to connect program to database
how to access database in applet
MS access
How to access the database from JSP?
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?
HOW TO CREATE COMMENT IN WEBSITE AND CONNECT TO DATABASE?
how to connect to database in php using mysql
Ms Access
Jdbc MS-Access question

Ads