Retrieving Data from database to combobox

Hi
Can anyone help in retrieving data from database to combobox..
All the names of employees and their designations are stored in database.so i want retrieve them in other page.
both designation and names of employees are comboboxes.
after loading tha page i need to get all the designations which are stored in database in first combobox and when i select a particular designation i need get all tha names of employees of that designation in other combobox.this has to be done using jsp and ajax.
please can anyone give me the code for this using Ajax and Jsp.

Hello Friend try this code
dbdata.jsp
<%@page language="java" import="java.sql.*"%>
<html>
<%
Class.forName("..........");
Connection n=DriverManager.getConnection ("....","...","...");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select ename from emp");
%>
<body>
<form>
<select>
<%
while(rs.next())
%>
<option><%=rs.getString("ename")%></option>
<%
%>
</select>
</form>
</body>
</html>

Similar Messages

  • Oracle form: how to retrieve data from database to pop list

    I have problem in retrieving data from database to item list in
    oracle forms.
    Can anyone help me.
    thanks.

    The next is an example but you can find this information in
    Forms Help:
    DECLARE
         G_DESCS RECORDGROUP;
         ERRCODE NUMBER;
         rg_id RECORDGROUP;
         rg_name VARCHAR2(40) := 'Descripciones';
    BEGIN
         rg_id := FIND_GROUP(rg_name);
         IF Id_Null(rg_id) THEN
         G_DESCS := Create_Group_From_Query (rg_name, 'SELECT
    DESCRIPCION DESCRIPCION, DESCRIPCION DESC2 FROM FORMAS_PAGO);
         ERRCODE := POPULATE_GROUP(G_DESCS);
         POPULATE_LIST('FORMAS_PAGO.CMBDESCRIPCION',G_DESCS);
         END IF;
    END;
    Saludos.
    Mauricio.

  • How to retrieve data from database to the structure(complicated)

    Hello everyone:
           I want to retrieve data from database to the structure. but the structure defined like this below:
    TOLERANZOB LIKE QAMV-TOLERANZOB
    TOLERANZOB1 LIKE QAMV-TOLERANZOB
    so how can I retrieve the data from the database ? make sure that the two fields contain data both.
    Thanks in advance .
    Regards
    Nick

    Hi Nick,
    To retreive data for TOLERANZOB from QAMV,
    If you know the key fields then use
    SELECT SINGLE TOLERANZOB FROM QAMV INTO TOLERANZOB WHERE keyfields.
    else, you can use
    SELECT TOLERANZOB FROM QAMV UPTO ONE ROWS INTO TOLERANZOB WHERE....
    Once you retreive the data using the select query, you can check if it is initial and if not move the data from TOLERANZOB to TOLERANZOB1.
    <b>Reward points for helpful answers.</b>
    Best Regards,
    Ram.

  • Error:Failed to retrieve data from database [Vendor Code:3001]

    Hello FOlks am trying to run a crystal report but when i try to run it somehow returns this error i.e [Error:Failed to retrieve data from database [Vendor Code:3001], I have no clue wats happening with this.Can anybody please throw some light on this.Am providing the sql behind this report for reference.
    SELECT "CLIENT"."CLIENT_NAME",
            "RECOVERY"."AMOUNT",
            "RECOVERY"."RECOVERY_TRANSACTION_INTERNAL",
            "RECOVERY"."ALLOCATION_CHECK_AMOUNT",
            "RECOVERY"."RECOVERY_DATE"
       FROM "HRI1_OWNER"."CLIENT""CLIENT",
            "HRI1_OWNER"."EVENT_CASE""EVENT_CASE",
            "HRI1_OWNER"."SETTLEMENT""SETTLEMENT",
            "HRI1_OWNER"."RECOVERY""RECOVERY"
      WHERE "CLIENT"."CLIENT_ID" = "EVENT_CASE"."CLIENT_ID"
        AND "EVENT_CASE"."EVENT_CASE_ID" = "SETTLEMENT"."EVENT_CASE_ID"
        AND "SETTLEMENT"."SETTLEMENT_ID" = "RECOVERY"."SETTLEMENT_ID"
        AND "CLIENT"."CLIENT_CODE" <> 'CLIENT  1'
        AND "CLIENT"."MAJOR_CLIENT_ID" in
            (Select major_client_id
               from major_client
              where major_client_code in ('LA', 'PFG'))
      ORDER BY "CLIENT"."CLIENT_NAME"Edited by: user11961230 on Nov 12, 2009 6:57 AM

    @oradba:Hi Thanks for getting bak. Well i have ran the query using PL/SQL Developer tool and yes its mapping to ORA-03001:unimplemented feature. i dont know what the problem is.
    @centinul: well i dont have any views in there.but still cudnt figure out why its throwing tht error
    Thanks
    Edited by: user11961230 on Nov 12, 2009 7:12 AM

  • Try to retrieve data from database got error message

    Try to retrieve data from database got error message *"java.lang.ArrayIndexOutOfBoundsException: 2*
    *     sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(JdbcOdbcPreparedStatement.java:1023)*
    *     sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedStatement.java:811)*
    *     guestbk.doGet(guestbk.java:32)*
    *     guestbk.doPost(guestbk.java:73)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:710)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)"*
    I have used prepared statment
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yy");
                java.util.Date dt = sdf.parse(str3);
                       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                       con=DriverManager.getConnection("jdbc:odbc:gbook");
                       //Statement stmt=con.createStatement();
    PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
    ps.setString(1,str1);
    ps.setString(2,str2);
    ps.setDate(3,new java.sql.Date(dt.getTime()));
    //ps.executeQuery();
                       //ResultSet rs=stmt.executeQuery("select * from gbook where emailid = str1");
                  ResultSet rs = ps.executeQuery();
                       out.println("<Html>");
                    out.println("<Head>");
                       out.println("<Title>GuestBook</Title>");
                       out.println("</Head>");
                       out.println("<Table border=1 align=center >");
                       out.println("<H4><B><center>Teacher's Lesson Plan</center></B></H4><BR>");
                       out.println("<TR><TD><b>Teacher Name</b></TD><TD><b>Class</b></TD></TR>");
               while(rs.next())
                        ctr++;
                        String email=rs.getString("emailid");
                        String cmt=rs.getString("comment");
                        out.println("<TR><TD>"+email+"</TD><TD>"+cmt+"</TD></TR>");
            }Please anybody help .

    PreparedStatement ps = con.prepareStatement("SELECT * from gbook where emailid =? AND date =?");
    ps.setString(1,str1);
    ps.setString(2,str2);
    ps.setDate(3,new java.sql.Date(dt.getTime()));Your SQL query has 2 placeholders but you try to set 3 values.
    And didn't you read the stack trace?
    guestbk.doGet(guestbk.java:32)You could've tracked down line 32 and seen what was there at that line.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
    ----------------------------------------------------------------

  • Failed to retrieve data from database?

    I am a new user
    When I try to Preview a document I am prompted to enter in database information.
    I have tried a few times to connect to my server and
    continuously keep getting the same error page
    No matter what I enter in the two fields, this is what pops up.
    "Failed to retrieve data from database"
    " Details: ADO Error Code:0x
    Source: Microsoft OLE DB Provider SQL server
    Description: Invalid object name: ScratchWO.dbo.tblsyslistviewprint'.
    SQL State:42502
    Code:208"
    When the OLE DB(ADO) page opens and asks for a server and a database, what is needed to stop the error from happening
    If anyone has any information that would be great !

    SQL State:42502 means an user authorization error.  Check the user and it's access to the target database.

  • How to Retrieve data from database into another form ?

    Good Day!
    Am currently new at JSP. I've been studying it for awhile and still getting the hang of it. We are working on a project.
    Editing a given data. We have to retrieve the given data and post it to another form "Editing form".
    Since we can retrieve data using JSP but how are we going to post it to another form? I mean how are we going to transfer data from one form to another?
    Can anyone help me with codes please..

    The client is a web browser.
    The client submits a request (click a link, visit a form)
    The server gets to respond to this
    - look at request parameters from the client
    - access database
    - produce resulting html page
    - send page back to client.
    The standard pattern is to retrieve data from the database in java code, and then load that data into a bean.
    You then make that bean available as an attribute
    It is then available for use in your JSP - either <jsp:useBean> tag or using ${ELexpressions}
    All you can pass from the client to the server is request parameters - which are always strings.
    Draw a picture of where the information is, and the information flows. Very rarely does it go directly from one "form" to another.
    Cheers,
    evnafets

  • DO Web Service allow you to retrieve data from database and make it pluggab

    Can Web Services allo you to retrieve data from the database and do they make the pluggable by allow you to plug them into any database.. how is that possible....

    Going through the javaee tutorial is one sure way of accelerating your learning curve, as almost every basic you will need to get your job done is explaiined well in there. i have been using it to learn building enterprise application and is awesome good resource.
    seriously consider downloading it
    java.sun.com/javaee/5/docs/tutorial/doc/

  • Error message-retrieve data from database

    I tried to retrieve data from oracle database. I got the following error message. I did compile the files without error. but when I run index.jsp I got the following error message. is it related with taglib Directives ?
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Exception in JSP: /index.jsp:8
    5: <% AccessDB accessDB=new AccessDB(); %>
    6:
    7: <%-- create an instance of List, then retrieve SubjectNames --%>
    8: <% List subjNames=accessDB.getSubjectName(); %>
    9:
    10: <%-- make list accessible to page --%>
    11: <% request.setAttribute("subjNames", subjNames); %>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    java.lang.NullPointerException
         org.AccessDB.getSubjectName(AccessDB.java:68)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:62)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    Apache Tomcat/5.5.17

    Hi,
    Try to print the value in List...n comment the request.setAttribute...n then run the program....
    check wot value is printed in List....
    This error may b because the List doesnt have anyvalue into it.....

  • Retrieving data from database into tabular layout item

    Hi..
    If the number of product_id is 1; I can retrieve data from the database into tabular layout item.However, if the number of product_id is more than 1 error message is shown.
    Here is my code:
    select product_id
    into : PRODUCTS. ID --Tabular layout item
    from products
    where customer_id=5;
    Any suggestions????

    It's simpler to do so:
    insert that code in a post-query trigger at block level (block where is multi-item)
    You will see after execute-query, your item will be populated.
    I wrote post-query trigger no post-quert
    Message was edited by:
    RV

  • Failed to retrieve data from database - DataDirect Paradox

    Crystal Reports 12.1.0.892
    Windows XP SP3
    DataDirect ODBC Driver for Paradox 5.30.00.23
    Paradox 5 database
    When I run the following query against two tables:
    SELECT `Ticket1a`.`PatronID`, `PHONELIN`.`PhoneNumber`
    FROM   `PHONELIN` `PHONELIN` INNER JOIN `Ticket1a` `Ticket1a` ON `PHONELIN`.`PatronID`=`Ticket1a`.`PatronID`
    I get the following error:
    Failed to retrieve data from the database
    Details: 42000: DataDirect ODBC Paradox driver    Extra characters at end of query:  INNER.  Database VendorCode: 3902
    The SQL tracing log can be found at http://188.grandtheater.org/sql.log
    Can anyone tell me what is going on here and how I can get around it?
    TIA

    I tried the Add Command option and entered the SQL query as follows:
    select ticket1a.patronid, phonelin.phonenumber
    from ticket1a ticket1a inner join phonelin phonelin on ticket1a.patronid=phonelin.patronid
    and still got the same error as before.  Using the following SQL query:
    select ticket1a.patronid, phonelin.phonenumber
    from ticket1a, phonelin
    where ticket1a.patronid = phonelin.patronid
    I was able to get results using the DataDirect driver.
    If I use the Microsoft Paradox driver (which is very slow.  15 minutes to run this query) and use the following SQL query:
    select ticket1a.patronid, phonelin.phonenumber
    from ticket1a ticket1a inner join phonelin phonelin on ticket1a.patronid=phonelin.patronid
    I will not get the error and I will get results.
    Any reasons why the DataDirect driver is producing errors?

  • Error retrieving data from database

    my problem is i cant connect my eclipse to database
    it display this error
    Error parsing data org.json.JSONException: Value <html><body><h2>Checking of type java.lang.String cannot be converted to JSONObject
    my apps can run correctly before...but last night i cant open it when want to retrieve any data from database
    can somebody help me?

    This doesn't seem to have anything to do with Eclipse, but I'd guess that a server-side error message is being returned a HTML rather than the JSON you expect.

  • Is there a way to retrieve data from database wihout using JDBC while using JPDK?

    Hi,
    I want to create a portlet using JPDK with extra render modes and edit/Edit defaults mode too. The detail and show renderer mode jsp's/servlets render data from database. Based on the personalized paramter, the data rendered in detail and show mode will be obtained from database.
    The articles in the PDK zip asks not to use JDBC for security vulnerability. Does that mean , I should not use JDBC to connect to db to get data. If not, what should I use ? How do I connect to database ? Is there any class which helps to connect to db without using JDBC ?
    thanks,
    Mainak

    I'm not sure what articles you are refering to, because there is no other way to access a database from a java program. Generally, security related docs tend to be a little paranoid (and so they should be), but you have to balance high security against getting the job done.
    Obviously, if using JDBC, you need to be careful about protecting your config files because they will contain connection information.

  • How to refresh the current page when retrieving data from database

    hi all
    in my application i want to navigate from different tables to different forms.  The data in the table and in the forms is comming fromthe database. when i select a navigation link to database of a form it is connecting to database.  so im manually refreshing the refresh button of I.E. which is big headache.  so is there any way to refresh my current table or form dynamically at run time to retrieve from database
    Thanks and regards
    khaja

    Hi,
      Refreshing a connection to Database means re establishing your connection each time.It will be load for the DB to load the data every time generally not advisable to do.
      Inorder to get the value from the DB you have load the driver and connect it using fireplug with the view for navigations.
      for the same refer this link.
    http://help.sap.com/saphelp_erp2004/helpdata/en/51/2c747ecd037842943bdb38be214719/frameset.htm
    Hope it helps.
    Rdgs,
    Guru

  • How to speed up retrieving data from database

    I write some code to get lots of data from mysql to draw many lines in my applet
    but when I run the program ,it run slowly.
    So I think it over to find a method.
    I do it like that:
    Use single Thread to get data from mysql to draw one single line.
    But when I executed my code.
    The error"Operation not allow after ResultSet closed".
    Have you come across such problems.
    I am sorry that my code is not at my hand.
    thanks very much.

    Sorry, it's not clear. Are you saying you're generating many threads, each with their own Resultset? Maybe several resultsets from the same Statement?
    I'm not sure a statement can support more than one Resultset at a time.
    In any case, whereas it probably makes sense to have a thread doing your database retrieval I would suspect multiple threads will actually make things worse, you're limited by the connection spead and how fast mySql can actually deliver the data.
    I think you may need to concentrate on the way that the database is set up and read and to judge that we'd need to see the SQL you're using to retrieve the data, and that for setting up the table you're reading from. You might find that, for example, adding appropriate indexes in the database might help. Or doing the SQL query a different way.

Maybe you are looking for