Jsp&Ms-access

hi ,
i need to connect the jsp page & MS-Access to retrive data from the data base.i need the code.

create a DSN and go with your jdbc code in the scriplets
wat is soo spl abt it ??

Similar Messages

  • Is it possible for an applet within a jsp to access a server session?

    I was trying to find info (and sample code) where an applet that is embedded and running within a JSP page accesses the same session of the jsp page it is in.
    The need is for the the applet to access a string within the session and capture it's value and then perform some actions with the string client side within the applet. The value of the string is not important for the example, just being able to access it is.
    Also can javascript cause the applet to call the server on say an "onclick" event? If so, how is this done?
    In otherwords, can javascript interact with an applet?

    Check out the documentation on Heterogeneous Connectivity.
    Hope this helps!

  • 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.

  • JSP page access regular Java class

    I am new to JSP. But most of the time people say JSP page access Java Bean classes.
    I want to know what if I want to access regular Java classes?? Should I do like this
    in the code:
    <%
         NormalJavaClass cl = new NormalJavaClass();
         cl.process();
    %>
    <%-- JSP page access Java Bean -- %>
    <jsp:useBean scope="session" id="formDataBeanObj" class="formdatatest.FormDataBean"/>
    <jsp:setProperty name="formDataBeanObj" property="*"/>
    <HTML>
    <HEAD>
    <TITLE>page1.jsp</TITLE>
    <BODY>
    <FORM METHOD="POST" ACTION="page2.jsp">
         <H2>User Name = <jsp:getProperty name="formDataBeanObj" property="username"/></H2>
    <%
         NormalJavaClass cl = new NormalJavaClass();
         cl.process();
    %>
    <P><INPUT TYPE="SUBMIT" VALUE="submit here">
    </FORM>
    </BODY>
    </HTML>
    Please advise. Thanks!!

    Yes, you can instantiate and reference any class visible to the Java runtime from within a JSP just as you can in an "ordinary" Java class. Behind the scenes, a JSP is converted into Java source code for a servlet class, and then compiled into the .class file. When you insert code into JSPs using either taglibs or code delimiters (<% %>, <%= %>), the JSP/servlet "engine" inserts this code into the servlet source code verbatim, and all non-Java text from the JSP is inserted into the source code inside of JspWriter.write(xxx) statements.
    If you'd like to see the source code that your JSP is converted into, run your JSP in Tomcat and look in the "work" folder within the Tomcat folder after you access it the first time. Experiment around with the JSP and see how code within the <% %> and <%= %> blocks is inserted into the .java file.

  • Database access using HTML, JSP, JavaBean, & Access

    I am trying to create an HTML page that a user logs into and can choose to query, add, delete or modify a specified database. I have created the HTML, the JSP, and access database but I can't figure out how to have 4 different JSP pages(one for each option) to get information from one JavaBean. PLEASE HELP

    http://swforum.sun.com/jive/thread.jspa?threadID=53106&tstart=0

  • RE: Using JavaMail with JSP when access relay is denied on smtp mail server

    Could someone please let me know how to get around the problem of sending an automatic email from a JSP when access relay is denied by the smtp mail server. Could it be that the username and password just needs to be added somewhere???
    Any thoughts on how to solve this problem would be greatly appreciated.
    Thank you!

    I know what you are talking about because I setup no relay on my mail server. I understand why you need to supply a username and password because if the server doesn't allow relay, then you must supply a username and password. Doing it by IP address wouldn't work because you have to know the IP address of all people accessing that page. I am in the same boat as you and once I find out the answer, you'll be the first to know. There is one quick workaround. Get your Net Admin to create a user specifically for the page you plan to send from. Get him to allow relaying for that one user. That worked on my setup and like I said, I'm setup the same way you are. Thanks, J

  • Ergent problem with the jsp file access in tomcat. HELP...

    I use tomcat as my server, I have one JSP file located in :
    webapps\abc\war\WEB-INF\jsp\index.jsp
    You see my project name is abc, I want to access the index.jsp file, I define another jsp file in the path: webapps\abc callled outside.jsp. I want to use outside.jsp to invoke the index.jsp.
    Inside outside.jsp it is :
    <html>
    <head>
    <title>index</title>
    </head>
    <body>
    <%@ include file="war/WEB-INF/jsp/index.jsp" %/>
    </body>
    </html>
    When I open the browser, and access, http://localhost:8080/abc/outside.jsp , the content of index.jsp was shown as expect. But, all the link pages of the index.jsp can not shown (PS: the link pages is located in the same path as index.jsp, they are all jsp files). I guess the problem may be that the <%@ include file="war/WEB-INF/jsp/index.jsp" %/> inside outside.jsp include the index.jsp as a static file. Is there any method to make all the link pages of index.jsp can be shown when call from outside.jsp???HELP
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon

    I don't know why your links can't be shown, but I can tell you that your suspect:
    I guess the problem may be that the <%@ include file="war/WEB-INF/jsp/index.jsp" %/> inside outside.jsp include the index.jsp as a static file.is wrong, because included jsp is dynamic, not static.

  • JSP with Access Database

    Could I use Access Database in JSP source code without Having DSN (DSN-less)
    I mean i do not want to set up a DSN in Control panel.
    I want only give JSP code a access database (.mdb)
    Please tell me the Connection String.
    Thank you

    try the following code:
    String url = System.getProperty("user.dir")+"\\db1.mdb";
    String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+url;
    try{
    System.out.println(conStr);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(conStr);
    JOptionPane.showMessageDialog(this,"connection created");
    }catch(Exception e){System.out.println("Error : "+e);}
    where db1.mdb is the database to be used in application
    find this code working let me ack. at [email protected]

  • Jsp database access using odbc - please help

    Hi friends,
    I�m trying a very simple database access program in jsp data base access using odbc. Odbc has to be used because thin driver or other drivers may not be available in every system of our college and as you know it's not that easy to make changes to those systems. My problem is so simple. I always get an exception in my program.
    My jsp content is as simple as:
    <%@ page import="java.lang.*,java.sql.*,java.io.*,registerbean" %>
    <jsp:useBean id="db" class="registerbean" scope="session"/>
    <%
    String str="insert into reg values('" + db.getName() + "','" + db.getUname() + "','" + db.getPass() + "'," + db.getAge() + ",'" + db.getSex() + "','" + db.getAdd() + "','" + db.getUgcourse() + "','" + db.getUgqual() + "'," + db.getPer() + ",'" + db.getIadd() + "')";
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:yogaesh","scott","tiger");
    Statement stmt=con.createStatement();
    stmt.executeUpdate(str);
    }catch(Exception e1){out.println(str);};
    %>
    the table reg has the structure:
    Name Null? Type
    CNAME VARCHAR2(20)
    UNAME VARCHAR2(20)
    CPSWD VARCHAR2(20)
    CONFPASS VARCHAR2(20)
    CAGE NUMBER
    CSEX VARCHAR2(5)
    CADD VARCHAR2(100)
    COURSE NUMBER
    CQUAL VARCHAR2(10)
    CPER NUMBER
    IADD VARCHAR2(100)
    The registerbean.java file is as below: (This seems to work fine because I tried printing the values using <%= %> tag and it worked out fine and moreover the query string is intact.)
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class registerbean
    private String name,uname,pass,cpass,age,sex,add,ugcourse,ugqual,per,iadd,otherugqual,ccode;
    public void setName(String a)
    name=a;
    public void setUname(String a)
    uname=a;
    public void setPass(String a)
    pass=a;
    public void setCpass(String a)
    cpass=a;
    public void setAge(String a)
    age=a;
    public void setSex(String a)
    sex=a;
    public void setAdd(String a)
    add=a;
    public void setOtherugqual(String a)
    otherugqual=a;
    public void setCcode(String a)
    ccode=a;
    public void setUgcourse(String a)
    ugcourse=a;
    public void setUgqual(String a)
    ugqual=a;
    public void setPer(String a)
    per=a;
    public void setIadd(String a)
    iadd=a;
    public String getName()
    return(name);
    public String getUname()
    return(uname);
    public String getPass()
    return(pass);
    public String getCpass()
    return(cpass);
    public String getAge()
    return(age);
    public String getCcode()
    return(ccode);
    public String getSex()
    return(sex);
    public String getAdd()
    return(add);
    public String getUgcourse()
    return(ugcourse);
    public String getUgqual()
    return(ugqual);
    public String getPer()
    return(per);
    public String getIadd()
    return(iadd);
    public String getOtherugqual()
    return(otherugqual);
    I initially thought the problem was with str but then str seems to be perfect and I get a string of the form �insert into reg values('c','c','c',98,'Male','c','B.Tech, Applied Artificial Neural Networks','HSC',9898,'h')� which I verified through a javascript debugger. The session scope used is to get values through the db bean from another jsp file. The problem is in the executeUpdate() line of this code. I even tried changing the updation table, but in vain. What could be done to rectify this? Please help me out and please do remember that I have no option but to use odbc.
    Thanks in advance.
    R. Yogaesh.

    I didn't verify the type of exception and i'm now going to do that, but then when the string is as perfect as needed, what is the need for a prepared statement? What is the basic difference between the two? And basically what is the problem with this piece of code which creates an exception? Please reply as soon as possible.
    Thankyou very much.
    R. Yogaesh.

  • JSP Database Access : 500 Internal Server Error

    Hello everybody!
    My JSP code run until I write the next:
    Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection connDB = DriverManager.getConnection("jdbc:odbc:OracleDB", "carlos_prb", "carlos_prb");
    Statement smentDB = connDB.createStatement();
    ResultSet rsDB = smentDB.executeQuery("SELECT * FROM websites");
    rsDB.close();
    smentDB.close();
    connDB.close();
    I need to access an Oracle Database. This code run in a java class, but not here. If I try to display the portlet the next message appears:
    Error: The listener returned the following Message: 500 Internal Server Error
    Somebody can help me, please?
    null

    Hi Charles,
    Thank you for yout help. I tried change this jar file for old one from
    jdeveloper 9 RC, but problem is still the same.
    I reviewed bcj4html.jar file too, and I did not discover problems in RequestParameters class.
    Have you any idea how to solve it ? I am sure that in project properties "libraries" I have selected
    all possible BC4J classes. (installation of DS and 9i database has made week before on new XP)
    Thank you very much for more info :)
    Ivo

  • JSP Database access - Urgent

    Hi,
    A simple data access program to set values in a db. I have the following problems.
    1. When I dont use if(request.getParameter("name")!=null) or any other parameter for testing null values, a row of null values is inserted each time I enter the jsp file.
    2. One more problem is that the update is not regular. It sometimes works fine, someother times it fails miserably. It seems that the connection is not closed properly as I receive such a message when I try to shut dwon oracle.
    3. A much more peculiar problem, when i paste a url directly into my browser, it runs fine, but not with location.href or a flash link!! eg the register.jsp file is reported as a nonexisting file (HTTP 404) when I provide a link to it from flash in the form http://localhost:8080/reg/register.jsp but when i type this url directly it works fine.
    My code for register.jsp is:
    <%@ page import="java.io.*,java.lang.*,java.sql.*,java.util.*"%>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:yogaesh","scott","tiger");
    Statement stmt=con.createStatement();
    if(request.getParameter("name")!=null)
    String str="insert into rt values('" + request.getParameter("name") + "','" + request.getParameter("uname") + "','" + request.getParameter("pass") + "','" + request.getParameter("cpass") + "'," + request.getParameter("age") + ",'" + request.getParameter("sex") + "','" + request.getParameter("add") + "'," + request.getParameter("code") + ",'" + request.getParameter("ugqual") + "'," + request.getParameter("per") + ",'" + request.getParameter("iadd") +"')";
    stmt.executeUpdate(str);
    stmt.close();
    con.commit();
    con.close();
    con=null;
    str=null;
    }catch(Exception e){out.println("Database error!!");}
    %>
    Please help me out and thanks in advance...
    R. Yogaesh.

    Hi,
    A simple data access program to set values in a db. I
    have the following problems.
    1. When I dont use
    if(request.getParameter("name")!=null) or any other
    parameter for testing null values, a row of null
    values is inserted each time I enter the jsp file. *********
    * Yup. Use .equals("") or .equals("null") as tests, depends on your servlet container
    2. One more problem is that the update is not regular.
    It sometimes works fine, someother times it fails
    miserably. It seems that the connection is not closed
    properly as I receive such a message when I try to
    shut dwon oracle. *************************
    Use this:
    Connection conn = null;
    try{
       //Do database stuff
    } catch {
       // Report your errors
    } finally{
       try{
         if(conn!= null){
            conn.close();
         }catch{}
    3. A much more peculiar problem, when i paste a url
    directly into my browser, it runs fine, but not with
    location.href or a flash link!! eg the register.jsp
    file is reported as a nonexisting file (HTTP 404) when
    I provide a link to it from flash in the form
    http://localhost:8080/reg/register.jsp but when i type
    this url directly it works fine.***********************
    Maybe your flash is on another computer/server? Try using the link http://<ip address>:8080/reg/register.jsp or http://<dns name>:8080/reg/register.jsp
    My code for register.jsp is:
    <%@ page
    import="java.io.*,java.lang.*,java.sql.*,java.util.*"%>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection
    con=DriverManager.getConnection("jdbc:odbc:yogaesh","sc
    tt","tiger");
    Statement stmt=con.createStatement();
    if(request.getParameter("name")!=null)
    String str="insert into rt values('" +
    request.getParameter("name") + "','" +
    request.getParameter("uname") + "','" +
    request.getParameter("pass") + "','" +
    request.getParameter("cpass") + "'," +
    request.getParameter("age") + ",'" +
    request.getParameter("sex") + "','" +
    request.getParameter("add") + "'," +
    request.getParameter("code") + ",'" +
    request.getParameter("ugqual") + "'," +
    request.getParameter("per") + ",'" +
    request.getParameter("iadd") +"')";
    stmt.executeUpdate(str);
    stmt.close();
    con.commit();
    con.close();
    con=null;
    str=null;
    }catch(Exception e){out.println("Database error!!");}
    %>
    Please help me out and thanks in advance...
    R. Yogaesh.

  • JSP and Access 2007 database

    i've been trying to look for codes on how to access the Access 2007 database (.accdb).
    i've done a previous JSP app with Access database, but it is of a lower version (.mdb).
    i need something like the following, but for the 2007 version. is it just a matter of changing the extension for both statements, or is there more to it?
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String DBQ = request.getRealPath("sales.mdb");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + DBQ + ";DriverID=22;READONLY=true";thanks.

    <%@page import="java.sql.*" %>
    <table boder="1">
    <%
    Statement statement;
    Connection conn;
    String url = "jdbc:mysql://localhost/dbName";
    String user = "username";
    String pass = "password";
    try {
        class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(url, user, pass);
        statement = conn.createStatement();
    String query = "SELECT images FROM database";
    ResultSet results = statement.executeQuery(query);
    while(results.next()) {
    %>
        <tr>
            <td><img src="<%= results.getString("images") %>"></td>
        </tr>
    <% } %>
    </table>The while loop will loop through your result set and print the table row for each image it finds in the query.
    Hope this helps,
    Jon

  • Jsp----microsoft access---image

    Hi everyone,
    I am trying to save an image in a Microsoft Access database, so i can make a query to that image using jsp, and display the image in the .jsp.
    The problem is that I don't know what data type to declare in "access" when i am creating the table.
    I have tried with OLE Object type, and it doesnt work;
    I tried also with Text type, and doesnt work either.
    what data type do i have to declare, and how should I save it in the database, so when i make the query from the .jsp the image will be displayed?
    thanks...

    Hi,
    I did it like this:
    <TD>
    <img src="images/<%= recordset.getString(5)%>">
    </TD>it worked correctly,
    but,
    I am having trouble getting all of the images from one column,
    this is what i'm trying:
        ResultSet result = null;
        ResultSetMetaData rsmd = null;
       int columns=0;
         try {
           rsmd = result.getMetaData();
           columns = rsmd.getColumnCount();
    <table width="60%" height="50%" border="1">
      <tr>
      <%
         try {
           for (int i=1; i<=1; i++) {
                 out.write("<th>" + rsmd.getColumnLabel(i) + "</th>");
      %>
      </tr>
      <%
            while (result.next()) {
               out.write("<tr>");
               for (int i=1; i<=1; i++) {
                 out.write("<td>" + result.getString(i) + "</td>");
               out.write("</tr>");
            }my problem is that I don't know how to insert the:
    <img src="images/what can I do?

  • Feature of JSP for access command of UNIX

    hello sir ,
    I interesting JSP for developer application on internet . Now , I would like feature of JSP that
    what JSP use command for access comand of UNIX example ls ,mail ,bg (background process) and
    return result of command example mail, bg (background process) to JSP ? please tell me too . Thank you very much.

    thank you for reply question to me
    Please talk detail about runtime & process class to me please and example for JSP call command UNIX "mail" via JSP :-)

  • Jsp sites access control

    Hi,
    i am new in web-app-programming.
    I have developed a few jsp pages. One of them is login page and the other should only be accessable after logging in the login page.
    The current state is: the pages can also be accessed directly with the url like this: "http://localhost:8080/application_root/my_url_pattern/somepage.jsp".
    I am looking for a solution to avoid the direct access per url.
    my ideas are:
    1) set the render control of the jsp site-> it works well-> but a bit complex
    2) out source the jsp site -> save the jsp sites somewhere else as the applicationroot-> I have the problem that the site could no be found. Can somebody tell me how can i solve this problem.
    thank u
    Ming
    Message was edited by:
    m_z

    You can set up a servlet filter in the web.xml. That lets you intercept every single request to certain areas of the app, and modify/redirect it if necessary.
    Example: This sets up a filter that runs on all requests to the "/tools" directory:
    In web.xml:
       <filter>
         <filter-name>testFilter</filter-name>
         <filter-class>com.TestFilter</filter-class>
       </filter>
       <filter-mapping>
         <filter-name>testFilter</filter-name>
         <url-pattern>/tools/*</url-pattern>
       </filter-mapping>And an example java class of a filter. This one just logs the request URI.
    package com;
    import java.io.IOException;
    import javax.servlet.Filter;
    import javax.servlet.FilterChain;
    import javax.servlet.FilterConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServletRequest;
    public class TestFilter implements Filter{
         public void init(FilterConfig arg0) throws ServletException {}
         public void destroy() {}
         public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
              if (request instanceof HttpServletRequest){
                   HttpServletRequest req = (HttpServletRequest)request;
                   System.out.println("Servicing request for " + req.getRequestURI());
                   chain.doFilter(request, response);
    }

Maybe you are looking for

  • IPlanet upgrade from 4.1 to 6.1

    I have an issue in that the images are not displaying correctly (little red 'x' in a box where an image should be and thatthe font for the text has now changed. Can anyone offer any insight as to how to possibly resove thsi issue?

  • Jdeveloper 11g R2 problem when publishing PL\SQL Web Service

    Hi Guys, I have been banging my head against the wall for the past few days trying to publish pl\sql package as a web service on a weblogic 10.3 but I keep running into the same problem. PL\SQL Package Source below create type dept_type as object (de

  • Can't hear audio  video from google or apps. What do I do?

    I Have an iPhone 5 I have had for a year and now it won't play audio from the Internet or my apps. I have tried turning off Bluetooth and resetting my phone. I even upgraded operating systems with the latest updates. But I can't figure out what is ca

  • Call function..Destination

    Hi Experts, My requirement is to call a RFC Java function in SAP. The Java function is an encryption function which has 4 parameters (Password, Message, Strength128, Strength256). I need to pass the data for the parameters from SAP to JAVA. With the

  • How plot Current VS Voltage (XY graph??)

    Hello, I obtain current and voltage by analog inputs of an USB 6009, and I need to plot it in the same graph (C vs V). Please help me, it is very important to finish my proyect. I attachment a sample of the graph that I want. Thanks Attachments: XY d