JSP with MS-Access

Discussion in 'JSP' started by casimirrex, Sep 10, 2006.

  1. casimirrex

    casimirrex New Member

    Joined:
    Sep 10, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    The example below demonstrates how to connect to MS Access DB using JSP.

    Code:
     <%@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(); 
         } 
     } 
     %>
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice