Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   JSP with MS-Access (http://www.go4expert.com/forums/jsp-ms-access-t1370/)

casimirrex 10Sep2006 18:00

JSP with MS-Access
 
Hi
In JSP client validation i've included the Javascript ,but it is not working any one bear my hand to me and the any tell me How to connect to JSP with MS-access
pls give with an example
thanks in advance
regards
rex

pradeep 20Oct2006 11:21

Re: JSP with MS-Access
 
The example below demonstrates how to connect to MS Access DB using JSP.

Code: JSP

<%@page import ="java.io.*"%>
 <%@page import ="javax.servlet.*"%>
 <%@page import ="javax.servlet.http.*"%>
 <%@page import ="java.sql.*"%>
 <%!
 Connection conn=null;
 Statement st;
 ResultSet rs;
 String login,password;
 String pass,logg;
 String sql;
 String database = "e:\trashmagic\login.mdb";
 String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=false"; public void jspInit()
 {
     try
     {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         conn = DriverManager.getConnection(url);
     }
     catch(Exception ex)
     {
         ex.printStackTrace();
     }
 }
 %>



All times are GMT +5.5. The time now is 11:34.