SUM(score) in JAVA/JSP

hi,
i want to add the total amount of a string called "score". In SQL this is done by "SUM(SCORE)... though how would i do this in JAVA/JSP?
Regards

fahafiz wrote:
right... good luck... but basically the results i want to add up is total score. this CAN NOT be done in SQL as it is a long process and too many filters involved.
          rsKSB = StmtKsbLit.executeQuery("SELECT SUM(bksb_Diag_Assessments.[Total Score]) FROM bksb_Diag_Assessments LEFT JOIN CommentScores ON CommentScores.Score=bksb_Diag_Assessments.[Total Score] AND CommentScores.Curric=bksb_Diag_Assessments.Curric  WHERE (bksb_Diag_Assessments.[Stu Ref No] = '"+sr_studentid+"') AND (bksb_Diag_Assessments.[Curric]='"+lit1_curric_ref+"') AND ([Date] =(SELECT MAX(Date) FROM bksb_Diag_Assessments WHERE [Stu Ref No] = '"+sr_studentid+"' AND Curric = '"+lit1_curric_ref+"'))");or
                int total = 0;
          while(rsKSB.next())
          lit1_out_of                              = rsKSB.getInt(2);
          lit1_total_score                    = rsKSB.getInt(1);
                total += lit1_total_score;
          commentid                              = spformat.format(rsKSB.getString("CommentID"));
          }I dunno, maybe I'm misinterpreting your problem, but it seems to me like either of these ways would work.

Similar Messages

  • Oracle Text and Java (jsp)

    Hi,
    I stored files( pdf,word) in blob column. I created index (INSO_FILTER) and i would like to query the files.
    String sword="test";
    String query = "Select COMPID,CREATED,NAME,CVNUMBER from COMPANYCV" + " where contains(CV,' "+sword+" ') > 0 " ;
    System.out.println(query);
    ResultSet rs = stmt.executeQuery(query);
    works fine i get the compid,date,number and filename of the stored file in the blob column. This info is displayed als a link(url). ie. <A HREF="ShowCv.jsp?NAME=doc1.pdf...... So when the user clicks on it, the appropriate program opens (word,acrobat reader) and the content of the file is shown.
    But i also want to know how many times the word test" is found in each of the documents? How can i do this in java (jsp)?
    And i want to highlight to word that is searched for in the document? Any help on doing this ( examples)? The doc should open in the browswer( html -version) and words
    should be highlighted.
    plz help!
    ps.
    if i use:
    select score(1),NAME,COMPID from COMPANYCV where contains(CV, 'BLOB',1 ) > 0 order by score(1) desc
    i get:
    100,Test2.doc,4
    39,Test1.doc,5
    the score is 39 with Test1.doc! But the word blob is not present in that document. What does the "score" realy mean?
    thx

    ok so far so good. Here is what i did;
    filter-> html
    I created a table filterresult:
    query_id number
    document clob
    in sql:
    begin
    ctx_doc.filter('cvindex', 30, 'filterresult',0,FALSE);
    end;
    so now the word document with pk=30 is stored in de blob column as html.
    in my jsp i call:
    String sql= "SELECT DOCUMENT FROM FILTERRESULT WHERE QUERY_ID=0";
    //System.out.println(sql);
    rs = stmt.executeQuery(sql);
    while(rs.next()){
    clob=((OracleResultSet)rs).getCLOB(1);
    is=clob.getAsciiStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[clob.getChunkSize()];
    while((length=is.read(b))!= -1){
    pos+=length;
    os.write(b);
    and the word document shows up in html in my browser!
    I created another table:
    table highlightresults(
    query_id number
    offset number
    length number
    highlight->
    in sql:
    begin
    ctx_doc.highlight('cvindex', 30, 'steven','highlightresults');
    end;
    i want to highlight the word "steven" in the word doc with pk=30.
    I got no error on excecuting this, but how do i combine the 2 thins: how can i open the filtered word document (html) with the highlights shown in a color??
    plz help!
    also; can someone give me and exampple on how to call these sql statements, like:"begin
    ctx_doc.highlight('cvindex', 30, 'steven','highlightresults');
    end; " in my JSP (java) page!
    thank you

  • In java/jsp got Error,ORA-01000: maximum open cursors exceeded,

    Dear ALL,
    We are facing a problem of in java/jsp. ORA-01000: maximum open cursors exceeded,We are using referance Cursor for returing the Record in java file.
    The Code is given below.
    import java.sql.*;
    import javax.sql.*;
    import com.india.trade.dbConnection.*;
    import oracle.jdbc.driver.*;
    import java.util.Vector ;
    public class IntRmsActivity
         private static JDBCConnection instance = null;
    private static Connection con = null;
         private static CallableStatement stmt_admin_getadmins = null;
         private static String str_admin_getadmins = "{ call Admin_conf.RMS_ADMIN_GETALLADMINS(?,?) }";
         static
              try
                   instance = new JDBCConnection();
                   con = instance.getConnection();
                   stmt_admin_getadmins = con.prepareCall(str_admin_getadmins);
    }catch(Exception se){se.printStackTrace();}
         public static Vector admin_getAdmins() throws Exception
              checkconnection();
              String message = null;
              Vector v_admins = new Vector();
              ResultSet rs_admins = null;
              stmt_admin_getadmins.registerOutParameter(1 , OracleTypes.CURSOR);
              stmt_admin_getadmins.registerOutParameter(2 , Types.VARCHAR);
              stmt_admin_getadmins.execute();
              message = stmt_admin_getadmins.getString(2);
              System.out.println("message " + message);
              rs_admins = ((OracleCallableStatement)stmt_admin_getadmins).getCursor(1);
              while (rs_admins.next())
                        v_admins.addElement(rs_admins.getString("adminid"));
              rs_admins.close();
              return v_admins;
    CREATE OR REPLACE PACKAGE Admin_conf IS
    TYPE REF_CRSR IS REF CURSOR; /* OUTPUT CURSOR VARIABLE TYPE */
    PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
                                            OUT_MESSAGE OUT VARCHAR2);
    END Admin_conf;
    CREATE OR REPLACE PACKAGE BODY Admin_conf
    IS
    PROCEDURE RMS_ADMIN_GETALLADMINS(RESULTS OUT REF_CRSR,
                                            OUT_MESSAGE OUT VARCHAR2)
    IS
    l_ref_out_crsr REF_CRSR;
    BEGIN
         OPEN l_ref_out_crsr FOR
         SELECT EXECUTIVE_ID adminid
         FROM MASTER_EXECUTIVE_ID
         ORDER BY EXECUTIVE_ID;
         OUT_MESSAGE := 'ADMIN IDS FETCHED SUCCESSFULLY';
         RESULTS := l_ref_out_crsr;     
    EXCEPTION WHEN OTHERS THEN
              OUT_MESSAGE := 'ERROR ' || SUBSTR(SQLERRM, 1, 60);
    END RMS_ADMIN_GETALLADMINS;
    END Admin_conf;
    Regards
    Ajay Singh Rathod

    Are you actually closing the connections, resultsets in all cases?
    From what you've posted you call
    rs_admins.close();but in that method, you propagate any exceptions that occur out to the caller method, which in turn just prints a stack trace.
    So if an exception occurs before you call the rs_admin.close() the result set will never be closed as the statement won't be reached.
    I'd add a speific exception handling routine to the admin_getAdmins() method and include a finally clause to close the result set in all cases. You can still onthrow the exception if you want.
    cheers
    -steve-

  • Java-JSP working with packages and classes

    Hi everybody,
    I'm bearly new on Java-JSP developping and I wanted to know how Tomcat (for example) manage the imported packages and classes.
    The fact is I'm working on a project ('/bob') which use some packages that I don't see in the '/bob' directory. So, is that possible that '/bob' is downloading packages and classes from Internet to '/bob/download' virtual repertory and use it? If it is true, is it possible to override this download by making '/bob' project using local packages or classes (example : com.boblibrary.classes.util in '/bob/WEB-INF/classes/com/boblibrary/classes/util') instead of downloading it?
    Therefore, the '/bob' project is using bugged classes (that I think it downloads from Internet) which I can't correct.
    Thanks for your help.
    - Renaud

    Thank you for your answer, but I can't imagine where is physicaly the class that my project use and show me as http://localhost:8080/atlassian-jira-3.13.2/download/ressources/br.com.ecore.jira.plugin.projectViewPlugin:ProjectViewTabPanel/js/projectviewtabpanel.js. Where is that Javascript file suppose to be on my hard drive? Or where is that class 'br.com.ecore.jira.plugin.projectViewPlugin' suppose to be on my hard drive? If it is not dowloaded from the Internet.
    I have no trace of that class on 'atlassian-jira-3.13.2/', neither on 'jdk1.6.0_18/', 'jre6/' or 'apache-tomcat-5.5.28/common/classes/'.
    Thanks.

  • OSB WSDL invocation from java /jsp client!

    Hi ,
    I did a sample work on invoking osb wsdl(based on DB adapter) from a java/jsp application.It worked fine!
    Its a simple select query wth parameter that was configured in my DB adapter.
    Below are the steps I follow -
    a.Created a DB adapter for collective response
    b.created BS out of jca
    c.Generated PS based on above BS.
    d.Performed some xquery tranformation in PS message flow response piepeline.
    e.Exported WSDL and tested it in SOAP UI ,getting the transformed response as required.
    When we generate Java client out of above WSDL in Eclipse ,it generates client for DB data,transformed data fields are not seen -How to obtain transformed data too through Java client?will this work ?
    Is it gud practice to generate java client directly n Eclipse (OEPE) or do we have any other alternative ways to generate Java client out of OSB WSDL?
    Please assist.
    Thanks,
    Ani

    Hi Anuj-
    My proxy was generated out of business ,i get 2 wsdl like master-child .Master wsdl holds referecnce to child wsdl.I hope wsdl generation is fine.
    When i invoke the proxy wsdl url from Java client ,i get below error -
    Exception in thread "main" AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: org.xml.sax.SAXException: Invalid element in com.oracle.xmlns.pcbpel.adapter.db.PhysicalTampered_Meter.PhysicalTampered_MeterOutput - PhysicalTampered
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Invalid element in com.oracle.xmlns.pcbpel.adapter.db.PhysicalTampered_Meter.PhysicalTampered_MeterOutput - PhysicalTampered
         at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
         at org.apache.axis.client.Call.invoke(Call.java:2467)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at com.oracle.xmlns.pcbpel.adapter.db.CoreAnalytics.PhysicalTampered_Meter.PhysicalTampered_Meter.PhysicalTampered_Meter_pttBindingStub.physicalTampered_Meter(PhysicalTampered_Meter_pttBindingStub.java:175)
         at Client.JavaClient.main(JavaClient.java:25)
         {http://xml.apache.org/axis/}hostname:B7B-3F-149-4HJV

  • Customization of Java/JSP/DHTML

    Hi All,
    I would like to know whether Oracle has laid any standards for the Customization of Self Service modules(all java,jsp,java script,DHTML).
    How do you guys recommend to do it? Normally what we do is copy the files to be customized and customize them and place it back and keep a back up of all files we customize.But my question in this case is,What if we upgrade to 12i in future ..which would be a major upgrade.So I guess if we place these customized files in the normal OA_JAVA and OA_HTML and OA_MEDIA all these files will be replaced by the standard oracle files during a major upgrade like this.Is there any way to keep the customized files un touched?
    One alternate approach which I have is to create a CUSTOM_TOP in the server and keep all the customized files in that?
    Thanks in advance !! Any suggestions are appretiated !!
    Chanchal
    [email protected]

    Hi All,
    I would like to know whether Oracle has laid any standards for the Customization of Self Service modules(all java,jsp,java script,DHTML).
    How do you guys recommend to do it? Normally what we do is copy the files to be customized and customize them and place it back and keep a back up of all files we customize.But my question in this case is,What if we upgrade to 12i in future ..which would be a major upgrade.So I guess if we place these customized files in the normal OA_JAVA and OA_HTML and OA_MEDIA all these files will be replaced by the standard oracle files during a major upgrade like this.Is there any way to keep the customized files un touched?
    One alternate approach which I have is to create a CUSTOM_TOP in the server and keep all the customized files in that?
    Thanks in advance !! Any suggestions are appretiated !!
    Chanchal
    [email protected]

  • Default java / jsp file which gets executed before DAM asset rendering

    Hi,
    I have a requirement to implement access control on DAM assets on the basis of a metadata property (tags).
    Is there a default JAVA / JSP file which gets executed before rendering a DAM asset?
    If yes, how can I override it?
    If no, how can I add a new JSP / JAVA file to be executed before rendering of each DAM asset?
    Thanks in advance,
    Anurag

    Hello Anuran,
    I dont think there is any api which is executed when you rendering any DAM asset on page component because for each type of DAM asset there are different APIs available which you use the render those dam asset like "Image" class to render the image asset.
    Each dam asset also support having different rendition format and if you are interested in that then refer http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/dam/api/DamEvent.Type.html
    Please let me know if you need more information
    Thanks,
    Pawan

  • Java/JSP app to List Directories in a Drop Down

    Hi all! I'm a Java Newbie and have an application that was written in VB / ASP that I need to convert to Java / JSP. The app is relatively simple, however my understanding of Java is even more basic. :(
    Here's what I need... The app needs to be able to read a directory structure on the web server and populated a drop down box on a JSP with the directory names. Then when one of the directories that are in the drop down are selected, the files within that directory are listed as HTML links to the actual files.
    How do I get started?? Any sample code from people who have done this??
    Thanks!
    Teresa

    Basically what you want to do is build a vector of objects that represent directories, and each "directory" object contains a vector of files as an attribute. This is done on the server side in a Servlet.
    Then store all these objects in your session. Dynamically build your dropdown box to have an element for each directory. Use the JavaScript onSelect method to invoke another JSP that takes the number of the element selected, and displays all html links for the number that was passed in from the previous servlet.
    For some about $150 I would write the whole thing for you, but here would be the server side code that builds a recursive directory list.
    import java.io.*;
    import java.util.*;
    public class RecursiveDirectoryList {
         Vector Directories = new Vector();
         Vector Files = new Vector();
    public RecursiveDirectoryList() {
         super();
    public static void main(String[] args) {
    String directoryName; // Directory name entered by the user.
    File directory; // File object referring to the
    //directory.
    //TextIO.put("Enter a directory name: ");
    directoryName = "C:\\docs";
    directory = new File(directoryName);
    if (directory.isDirectory() == false) {
    // Program needs a directory name. Print an error message.
    if (directory.exists() == false)
    System.out.println("There is no such directory!");
    else
    System.out.println("That file is not a directory.");
    else {
    // List the contents of directory, with no indentation
    // at the top level.
    listContents( directory, "" );
    } // end main()
    static void listContents(File dir, String indent) {
    // A recursive subroutine that lists the contents of
    // the directory dir, including the contents of its
    // subdirectories to any level of nesting. It is assumed
    // that dir is in fact a directory. The indent parameter
    // is a string of blanks that is prepended to each item in
    // the listing. It grows in length with each increase in
    // the level of directory nesting.
    String[] files; // List of names of files in the directory.
    System.out.println("Directory: " + dir.getAbsolutePath());
    indent += " "; // Increase the indentation for listing the contents.
    files = dir.list();
    for (int i = 0; i < files.length; i++) {
    // If the file is a directory, list its contents
    // recursively. Otherwise, just print its name.
    File f = new File(dir, files);
    if (f.isDirectory())
    listContents(f, indent);
    else
    System.out.println("File: " + dir.getAbsolutePath() + "\\" + files[i]);
    } // end listContents()

  • New To java/JSP

    I am new to JAVA/JSP. I downloaded and installed tomcat. When I try to start it I am getting an error. (java.exe has encountered a problem and needs to close.) It will not start. I am running on Windows-xp. Anyone has any ideas as to what the problem could be ? Do I need to do anything special for Windows-xp ?
    Thanks for your help.
    - Madan

    Your description is not very detailed but I'm using Tomcat quite well to run my JSP/Beans stuff which I'm progressing in learning.
    Tomcat is actually "jakarta-tomcat-4.1.18", and to start the server I use d:\jakarta-tomcat-4.1.18\bin\startup.bat
    You need to set up various classpath and directory info in setclasspath.bat
    Assuming you then get the thing started, to test it out, go to
    http://localhost:8080/index.jsp (unless you changed 'localhost')
    Please post more questions if you want - I'm sure someone can help.
    Gary

  • Tracking a separate Thread  - java/jsp/struts

    Hi all,
    My project is a webapplication using java/jsp/struts. My requirement is to write bulk data to a file, which i want to run as a separate thread. Since it runs as a separate thread the control comes back to UI (userInterface) page. On subsequent request from UI page by the user i want to check whether the thread process is completed or not , so that i can read from the file. Is it possible to simultaneously read from the file when the thread is in the process of writing data to the file. If so any idea on how to implement this functionality in java?
    How to keep track of the separate thread (whether it is completed or not) in java?
    Is it possible to read from the file when the thread is writing to the file in java?
    Thanks is advance.

    dangerous wrote:
    How to keep track of the separate thread (whether it is completed or not) in java?Thread#join().
    As you're already asking this trival question, I highly recommend you to read the Concurrency Tutorial here at Sun.com. Google can find it.
    Is it possible to read from the file when the thread is writing to the file in java?Not with java.io. You can use the java.nio API for that. You can also read/write it in memory (as a byte[] or a ByteArrayInputStream/OutputStream property) and if it is finished then write it to disk.

  • Any CASE tools for Java, JSP, and JavaBeans?

    For Java, JSP, and JavaBeans can we find something that can help us automate certain tasks?
    For example, CASE tools is an acronym for Computer Aided Software Engineering tools. I have a colleague use software to generate robust code for the database layer and with a few clicks of a button after the database is designed he can generate code that would otherwise take an hour or even hours to write and debug and test.
    Thanks for your time and help in advance!
    Cecilia

    The ones I know are MVCase (from Brazil) and Jude (from Japan). Both are free and I haven't fully tested them yet. It may help you.

  • Java, JSP, Servlet....!!!!????Can you help me?

    Hi all,
    Now I want to use Java (JSP, Bean, Servlet and EJB) for programming (application/web/internet/database). Which architects I should use?
    JSP --> Database.
    JSP --> Beans --> Database.
    Servlet --> Database.
    JSP & Servlet --> Database
    JSP & EJB --> Database...
    Can I use COM/DCOM such as ASP pages?
    And which databases (SQL Server, Oracle, Access, DB...) I should use? Which web servers (Jrun, JWS, Apache, JWS, Orion...)?
    Are there some stuff on Internet relate to this topic (some samples)?
    Thanks so much.

    Hi all,
    Now I want to use Java (JSP, Bean, Servlet and EJB)
    for programming (application/web/internet/database).
    Which architects I should use?you can use the Model-View-Controller or MVC model.
    Model = JavaBeans --> for your business logic/process
    View = JSP --> for your presentation like HTML
    Controller = Servlet --> as your router or dispatcher of the JSPs.
    And which databases (SQL Server, Oracle, Access,
    DB...) I should use? for large business applications that would require security, optimization, etc., i suggest that you go for a good dbase and i'm referring to Oracle, SQL Server, Sybase, Informix, and the likes. But, if you're going to do simple application, MS Access can do the job. Since it comes with MS Office installation, you'll not find it any harder to configure your dbase.
    Which web servers (Jrun, JWS, Apache, JWS, Orion...)?you can use the following apache, IIS, Websphere, etc...
    don't forget that you also need an application server. say, tomcat application server and apache web server.

  • Java/JSP Website Hosting

    Is it ideal to go with a company that offers shared Java/JSP hosting or would it be necessary to opt for a dedicated server??? With that being said, is their a reliable company out their that is not to expensive for an individual not a business (i.e. not RackSpace)?

    codeamatic wrote:
    Is it ideal to go with a company that offers shared Java/JSP hosting or would it be necessary to opt for a dedicated server??? With that being said, is their a reliable company out their that is not to expensive for an individual not a business (i.e. not RackSpace)?This question seems a bit off topic for this forum and worse I think is a magnet for spam/questionable posts. *
    You should sit down and define your requirements in terms of resources and then investigate further. Shared/dedicated is not a good starting place IMO because one company's shared may be equal in terms of filling your requirements to another company's dedicated.
    * - in the line of disclosure I am a hosting provider of the services discussed here but I do not solict business by way of these forums.

  • How to view pdf file in java/jsp?

    Hello Everybody,
    Any one help me how to view pdf file in jsp using java application.
    I have pdf file c:\app.pdf.
    How can i display the pdf file.
    Please help me.................
    Thanks

    Hello,
    You can use the below code, but i am not sure how far is this a startard way of doing it.
    # <%
    # ServletOutputStream servletOutputStream = response.getOutputStream();
    # File reportFile = new File("C:\\Tomcat 5.0\\webapps\\TestApp\\myfile.pdf");
    # FileInputStream fis = new FileInputStream(reportFile);
    # byte[] bytes= new byte[128000];
    # int count=fis.read(bytes);
    # try
    # response.setContentType("application/pdf");
    # response.setContentLength(bytes.length);
    # servletOutputStream.write(bytes, 0, bytes.length);
    # servletOutputStream.flush();
    # servletOutputStream.close();
    # }catch(Exception e){}

  • How to execute a .exe file in java(Jsp) without using a process ???

    Hi All ,
    How to execute a .exe file in Jsp without using a process ??? ...
    Is it Possiable ????

    itsdhanasaraa wrote:
    But as this a web application ... By using Runtime i'm getting some probs ..
    Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
    Ain't gonna happen.
    its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
    1) it's not "taking more time to execute", whatever that's supposed to mean.
    2) there's no other way to execute something. Not that you should every use even that way anyway
    3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place.

Maybe you are looking for