how to connect to MS access database in JSP?

Ads
 

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 to MS access database in JSP?
How To Connect MS ACCESS 2003 Database in C Program with Graphics.
Advertisements
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java - Java Beginners
how to connect java with ms access using odbc in eclipse
link hibernate to MS ACCESS database
Connect database in Access to Netbean?
How to Access MS Access in jar.
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 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 values from jsp into ms access
How to insert or delete records in MS access database using jsp - JSP-Servlet
How to use JTable with MS-Access
How to use JTable with MS-Access
How To Display both image and data into Swing JTable which is retrieved from ms access database
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
to get picture from ms access database by jsp-servlet....
JSP1
JSP2
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
ms access
Protect JSPs from direct access
applet connected to table in MS Access database
How to connect with database
how to connect program to database
MS access
HTML(Registration form) to Jsp to stored into MS ACCESS database
MS Access connct using flex with java

Ads