Professional Documents
Culture Documents
JDBC Connection For Access Database in JSP
JDBC Connection For Access Database in JSP
Document : index
Created on : Jul 7, 2010, 7:23:33 PM
Author : VIP
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*"%>
<%@ page import="java.io.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<%
ResultSet rs;
String print = new String();
try {
// Step 1. Load the Type 1 database driver:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Step 2. Create a connection to the database
// using pre-defined Data Source:
// I have placed my database in location c:/Train.accdb
String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" +
"c:\\Train.accdb";
Connection con = DriverManager.getConnection(conStr, "", "");
</body>
</html>