How to connect JSp to ms-access?

hello Everybody,
I have a database created in MS-Access. Database name "est". Table name "Customer".
I have created System DSN by name "est" for Access database.
This Customer table contains user-id and password.
Now, from front end, using JSP, i have created a login page. USer will enter their id and password....
in the following code, i am trying to access this table IF there is any record with user entered cid and password, count's value will be 1 else 0.
<%@ page language="java"%>
<%@ page  import="java.text.*,java.sql.*,java.util.*,javax.servlet.*,javax.servlet.http.*" %>
<%
//creating a Connection, to connect to the database
          try {
               String uid = request.getParameter("Lng").trim();
               String pwd=request.getParameter("pwrd").trim();
               String query = new String();
               ResultSet rs = null;
               Connection con = null;
               //initializing the JDBC-ODBC bridge driver
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              //open a connection to the database
               con = DriverManager.getConnection("jdbc:odbc:acc",uid,pwd);
              //execute the query
           Statement stmt = con.createStatement();
             query="select count(*) as count1 from est.Customers where cid='"+uid+"'password='"+pwd+"'";
               System.out.println(query);
               rs=stmt.executeQuery(query);
               System.out.println("creating the connection is success");
               session.setAttribute("uid",uid);
               session.setAttribute("pwd",pwd);
               session.setAttribute("connect","yes");
               response.sendRedirect("");
               } catch(Exception e)
               System.out.println("Error in creating the connection"+e);
                out.println("Error in creating the connection");
                response.sendRedirect("login1.jsp");
     %>
     <html>
                         <head><title>Validation Screen</title>
                         </head>
                         <body>
                         <FONT STYLE=Courier: color=RED  SIZE=5>
                         <p align=center><b><font SIZE=4 color=brown face=" ">LOGGEDINN SUCCESSFULLY</font></b>
                         </body>     
                         </html>
               But, i am getting "No data found error". Can anyone please help me in this regards, please?
Regards,
Thanks in advance for your time and help
Ashvini

i have to connect jsp to sql server
how can i do this::::::::::::
actually,i have written the code in textpad in java file which is working fine
but when i apply the same code in jsp file in weblogic , it is giving error in line
"DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());"
weblogic is not recognising "com.microsoft" package in this line
but i haven't done anything special in textpad
looking forward for reply
My code written in textpad:::::::::::
import java.sql.*;
* Microsoft SQL Server JDBC test program
public class TestCalculator {
public TestCalculator() throws Exception {
/******************* Get connection ************************************/
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://192.9.203.153:1433","attend","attend");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
System.out.println("HELLO");
Statement stmt;
try
stmt = connection.createStatement();
               ResultSet resultSet = stmt.executeQuery("Select * from tblcode where empcode='2923'");
                    while (resultSet.next()){
                    System.out.println(resultSet.getString(1) + " " + resultSet.getString(2)+" "+resultSet.getString(3));
                    resultSet.close();
//stmt = conn.createStatement();
//stmt.executeUpdate("insert into EmployeeData " +
//"values('name', 'salary','joiningDate','empId','leavingDate')");
/*stmt.executeUpdate("insert into cust_profile " +
"values('name2', 'add2','city2','state2','country2')");
stmt.executeUpdate("insert into cust_profile " +
"values('name3', 'add3','city3','state3','country3')"); */
stmt.close();
connection.close();
catch (Exception e)
e.printStackTrace();
}//TestCalculator
public static void main (String args[]) throws Exception {
TestCalculator test = new TestCalculator();
}//End of class

Similar Messages

  • How to connect jsp & ms-access

    hi,
    i need to retrive data from database.how to connect jsp & ms-access.i m using weblogic8.1.

    hi,
    i need to retrive data from database.how to connect jsp & ms-access.i m using weblogic8.1.

  • How to connect java to MS Access

    How to connect java to MS Access using jdbc
    Can U write the complete code for it ? How to interact with the fields ?

    G O O G L E
    http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2691&lngWId=2
    http://blog.taragana.com/index.php/archive/how-to-access-ms-access-database-from-jdbc/

  • How to Connect JSP (Tomcat) with MS access Database

         ^
    Hi all:
    I have been trying to connect JSP using tomcat server with database in MS Access..I have been going through the required steps...but it seems it is a bit complicated...pls help.
    ps: I used to get this message when I run the program:
    C:\jakarta-tomcat-4.0-b5\work\localhost\feras\db1_jsp.java:71: Class org.apache.jsp.PreparedStatement not found.
         PreparedStatement sql;
         ^
    C:\jakarta-tomcat-4.0-b5\work\localhost\feras\db1_jsp.java:81: Undefined variable or class name: DriverManager
                   dbconn = DriverManager.getConnection(url);
                   ^
    C:\jakarta-tomcat-4.0-b5\work\localhost\feras\db1_jsp.java:111: Class org.apache.jsp.SQLException not found.
              catch (SQLException s)

    Hi friends:
    this is the source code, I am working on tomcat server, and it doesn't work at all
    <html>
    <head>
    <%@ page
         import = "java.io.*"
         import = "java.lang.*"
         import = "java.sql.*"
    %>
    <title>
    JSP Example 2
    </title>
    </head>
    <body>
    <h1>JSP Example 3</h1>
    <%
         String     place;
         String url = "jdbc:odbc:ferasdb";
         Connection dbconn;
         ResultSet results;
         PreparedStatement sql;
         try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              try
                   int     latitude,longitude,easting,northing;
                   boolean     doneheading = false;
                   dbconn = DriverManager.getConnection(url);
                   place = request.getParameter("place");
                   sql = dbconn.prepareStatement("SELECT * FROM gazetteer WHERE feature = '" + place + "'");
                   results = sql.executeQuery();
                   while(results.next())
                        if(! doneheading)
                             out.println("<table border=2>");
                             doneheading = true;
    latitude = results.getInt("latitude");
    longitude = results.getInt("longitude");
    easting = results.getInt("easting");
    northing = results.getInt("northing");
                        out.println("<tr><td>" + latitude);
                        out.println("<td>" + longitude);
                        out.println("<td>" + easting);
                        out.println("<td>" + northing);
                   if(doneheading)
                        out.println("</table>");
                   else
                        out.println("No matches for " + place);
              catch (SQLException s)
                   out.println("SQL Error<br>");
         catch (ClassNotFoundException err)
              out.println("Class loading error");
    %>
    </body>
    </html>

  • How to connect JSP with MySql Database?

    HI All...
    I want to know or How to connect Mysql with JSP or JSF any other software is available? please help me.....

    I want to know or How to connect Mysql
    with JSP or JSF any other software isavailable?
    please help me.....First you need to find 25 m of a CatV cable and...The DB files need to be located on the ninth device of a SCSI Daisy Chain with the total SCSI cable length being over 150 m (and the devices (and cables) need to be mix of Differential and Non-Differential).
    Edit: And forget the terminator, who needs it?

  • How to connect oracle with ms access database

    Dear
    We are on release r12, right now we have requirement to connect oracle database with ms access to get some information. We have found gateway(Heterogeneous services) using ODBC, but at the database side where is installed oracle r12 there is no installed ms access software becuse of linux operating system, so how could it will connect ms access because without installing ms-access we are unable to find ms ODBC gateway in ODBC driver under the control panel.
    Can any body guide me how could achieve this
    Edited by: oracle0282 on Sep 21, 2011 12:47 AM

    If I understand you correctly you want to access Oracle on Linux from MS-Access (possible on Windows only). You need neither a gateway nor Heterogeneous Services, but an Oracle client including ODBC driver (Instant client with ODBC driver is enough) on the Windows machine.
    Configure the ODBC driver with the connect informations to the Oracle server.
    Werner

  • How to connect JDeveloper to MS Access Application

    I have a MS Access Application to connect. Language is BPEL.
    I've tried to use database adapter wizard to create the JDBC-ODBC bridge connection, but there's no username and password in the Access database, so this doesn't work.
    Anyone please teach me how to do it.

    http://tinyurl.com/2dcyyys

  • How to connect jsp to oracle?

    My system is not working,why?
    System:
    Os: Windows NT 4.0 + SP4
    Db: Oracle 8i for NT
    JDK: J2DE 1.3.1
    Web: Tomcat 4.01
    IE: IE 5.5
    My Jsp file:
    <HTML>
    <HEAD>
    <TITLE> Database Jsp Test </TITLE>
    </HEAD>
    <%@ page info="database handler"%>
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <BODY>
    <%
    try
         String DBUSER = "user";          
         String DBPASSWD = "passwd";          
         String DBCONNSTRING = "jdbc:oracle:thin:@dataserver:1521:testbase";
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
         Connection con=DriverManager.getConnection(DBCONNSTRING,DBUSER,DBPASSWD);
         Statement stmt = con.createStatement();
         String query="select UserId from UserInfo";
         ResultSet rs = stmt.executeQuery(query);
         while (rs.next())
              out.println(rs.getString(0));
              out.println("<br>");
         con.close();
    catch (Exception e) {}
         out.println("Connection is not open!");
    %>
    </BODY>
    </HTML>
    Run my Jsp file, error is "oracle.jdbc.driver.OracleDriver not found".
    I have put classes12.zip(in oracle\jdbc\lib) into Tomcat\lib and web-inf\lib.My CLASSPATH :
    Classpath=.;e:\jdk1\lib\tools.jar;E:\Oracle\Ora81\jdbc\lib\classes12.zip;%TOMCAT_HOME%\lib\servlet.jar;%TOMCAT_HOME%\lib\webserver.jar;%TOMCAT_HOME%\lib\jasper.jar;%TOMCAT_HOME%\lib\xml.jar;%TOMCAT_HOME%\classes;
    How to solution to the problem?Thanks a lot...

    Something you may want to look into doing is using jspInit() to handle connecting to the database. Something similar to this:
    public void jspInit() {
      try {
        // load the driver
        Class.forName("oracle.jdbc.driver.OracleDriver");
        // get the connection
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora81", "username", "password");
      } catch (Exception ex) {
        // inform the web container of problems
        ex.printStackTrace();
    }Just use the <%! %> directive to section out the page properly. A better method would be to use a properties file, a database connection Servlet, and a custom TLD to handle iterating through resultsets.
    Enjoy

  • JSP - MySQL - MS Access

    I have a set of tables in MS Access database and MySQL database.
    My jsp application is running with the help of Apache/Tomcat in Linux box.
    I've the MM.MySQL Driver to integrate MySQL with my application.
    my problem is to know how to communicate jsp with MS Access here.
    I don't know how to connect jsp to MS Access in Linux.
    I searched for solution and finally got an idea of using MyODBC api.
    I need to import data from MS Access to MySQL using MyODBC on Linux.
    Can anyone help me on how to install,configure MyODBC and import data.
    or please pass any reference url.
    or
    please suggest me any solution for this.
    Thanks
    Senthil

    Thats what I meant. If both (Access and MySQL) both run on Windows there should be no problem. But if MySQL is on Linux and Access is on Windows it could be.
    How about setting up Mysql on Windows, going the way magnoli supposed and after that using mysqldump to export zo linux.

  • How can I connect JSP in IPlanet that access to EJB in Weblogic?

    Hi:
    I have a JSP in IPlanet that access to EJB in Weblogic.
    IPlanet and Weblogic are installed in different machines.
    I don't know what code source and deployment actions to do to connect jsp and ejb. Can anybody guide me?
    Thanks in advance,
    David B.

    Hi,
    now only i am initiating the combination of iplanet webserver 4.1 and weblogic 5.1 application server for my project. I can able to execute jsps through iplanet webserver.
    Can u explain clearly jsps calls over to ejb which is stored in weblogic? How i will handle this combination in single machine?
    thanks in advance
    vijay.

  • How to use taglibs in JSP for Database access

    Hi
    Could any one please tell me how to use taglibs in JSP for Database access
    with regrds
    Jojo

    This is a sample how to connect to a MySQL database with JSTL 1.0:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>JSTL MySQL</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <c:catch var="e">
    <sql:setDataSource var="datasource" url="jdbc:mysql://Your_Server_Name_Here/You_Schema_Here"
                           user="Your_Username_Here" password="Your_Password_Here"
                           driver="com.mysql.jdbc.Driver"/>
    <c:out value="datasource= ${datasource},  Class = ${driver.class}"/>
    <br />
    <br />
    <sql:query var="deejays" dataSource="${datasource}">SELECT * FROM Your_Table_Name_Here</sql:query>
    <table>
    <%-- Get the column names for the header of the table --%>
    <c:forEach var="columnName" items="${deejays.columnNames}"><th><c:out value="${columnName}"/></th></c:forEach>
    <tbody>
    <%-- Get the value of each column while iterating over rows --%>
    <c:forEach var="row" items="${deejays.rows}">
      <tr><c:forEach var="column" items="${row}">
            <td><c:out value="${column.value}"/></td>
          </c:forEach>
      </tr>
    </c:forEach>
    </tbody>
    </table>
    </c:catch>
    <br />
    <br />
    <c:if test="${e!=null}"><span class="error">Error</span>�
      <c:out value="${e}" />
    </c:if>
    </body>
    </html>And this thread might help you:
    http://forum.java.sun.com/thread.jspa?threadID=639471&tstart=44

  • How to connect my Macbook with an ipad mini in order to have an access to the internet on my iPad?

    Dear fellows, I am having a trouble in how to connect my mac with an iPad mini in order to have an access to the internet.

    If you are attempting to share your iPad mini's cellular data connection with the MacBook, please check out the following Apple Support article for additional details on how to do so.

  • How to connect my access database using applet?

    hi all,
    i need to connect my access database in my applet program which should work like an atm machine..I dont know how to connect it. Im new to applet same thing in JDBC application. Please help i terribly need it, our deadline in our case study is fast approaching and i still dont know how to do it. I tried the tutorial but i received some sql exception error. thanks!

    Try this link
    http://java.sun.com/docs/books/tutorial/jdbc/basics/

  • How to connect oracle application server portal to MS access DataBase

    Hello,
    I am facing one problem here.
    Our client is having their database in MS access and they want to implement the oracle application server portal for their organization then how to connect the MS access DB to oracle Application server portal

    There is a worked example of how to connect oracle to an Excel spreadsheet, which is easily modifyable to read from an Access Database.
    http://asktom.oracle.com/pls/ask/f?p=4950:61:::::P61_ID:4406708207206#18830681837358
    I had some concurrency problems - only one person could use the link at any one time, so I used it to load the data into oracle tables.
    Tak

  • How to connect MS Access or other d/b tools to SAP R/3

    Hi SAP Experts,
    I got a requirement i.e by using MS Access or other database tools to take the SAP table dumps and analyze gaps or errors in the system data using business guided .
      I don't know how to connect MS Access to SAP R/3 and how to connect other database tools to SAP R/3.
    pls any body can explain me on this topic or inform me where i can get the corresponding documents.
    This is urgent for me.
    I appreciate you're help.

    Hi,
    For some databases (for example MSSQL, Oracle,...) you can use transaction DBCO (table DBCON) to create connection to external database. Then you can use native SQL in ABAP programs (EXEC SQL command).
    Krzys

Maybe you are looking for

  • Project Payment/Revenue report

    hi, I want WBS wise report which shows payments made to the vendors against the payments recieved from customer for the same WBS. Pl suggest. Rgds

  • Customs duty

    Hi experts, In Pricing procedure two conditions types are being used zcd5 and zcd6 the control data for both the condition types is same and they are marked as statistical and Akt key and Accruals are entered for both the condition types But for ZCD5

  • Reset button in Dashboard showing error

    Hi, I have placed the code for reset button in the text box and checked the HTML Markup And in the dashboard the Reset Prompts is displayed. When i click the button its showing the below error. *"The page cannot be found* *The page you are looking fo

  • Hide button in bid invitation on condition basis

    Hello All, There few push buttons in the bid invitation screen.i want to hide the buttons based on the bid invitation status. The configuration id hides the push button permanent. For Example : if the technical bit is not opened then when the purchas

  • Create Handling unit after receiving finished goods

    Hello, My client's requirement is that they do not want a TR or TO to get created at the time of Production order confirmation and neither they want to create the Handling unit at the time of confirmation. They want to move the material from producti