Result set plz iam confused

Hello sir,
I have database for names ok it works fine
but if iam entering the names with spaces like
Raj kulkarni which is the full name of person it is going into the database but when i access into another form for other module through
rs.getString(1) this field is for name
then i will get
only Raj so what i have to do, plz tell me.
vin.

Hello sir,
Really iam afraid abt the responses really ,why that
is so wrong what i should do if i want access the
html through database then i should use jsp only know
,these may be looking very foolish for u people but
we the beginnersStop here. As a beginner, you shouldn't even be close to anything J2EE related. Get some programming and design experience first, most importantly about the MVC pattern. Just because you know the JSP or Java syntax, it doesn't make you a usable programmer.
An important thing to any application is a good design. JSPs accessing a database with lots of scriplets creating incorrect HTML is about as bad as it could possibly get.
will have problems mainly related to
database plz dont discourage us in this way why we
post our problem because u r seniors
and genius in java technology but plz dont discourageNobody discouraged you. You were actually told what not to do and what to do instead. If you don't follow this advise which would make your program simpler to understand, debug and maintain, don't expect us to be all eager on helping you any further.
Further, you don't seem to be able to communicate well in English. This is no problem by itself, but it makes things hard for us. So the suggestion for you to get a personal tutor is more than reasonable: someone you can ask without the overhead required to post at a forum, and without the language barriers that keep us from understanding your questions and you from understanding the answers.

Similar Messages

  • How to highlight result set data on world map

    Hi,
    I want to show the graphical representation of world map to highlight the countries which having the maximum booking of hotels of our client xyz.
    All the values are coming from the mysql db .
    I want the library which will draw the world map on the Jpanel for the respective result set
    Plz help me for this .
    I generally use the JFreeChart for drawing the other graphs but the Jfreechart don't have the library for the World Map or Destination Graph etc.
    Hint: ( Google Analytic's map is the best example )
    Thanks In Advanced
    Mahesh

    This isn't what you want, but it will get you on the right track. I chose the most complex image I could find so give it a few seconds to read the image and build the paths. The parser is catered to the image I chose, but in general you can probably expect the "path" element to delineate the boundaries for any map svg. The particular image I chose grouped the paths with country ID so I added a little mouse interaction to the GUI. Forgive me for any dumbly coded stuff. I didn't put much effort into streamlining it.
    import org.xml.sax.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.helpers.DefaultHandler;
    import java.awt.geom.Path2D;
    import java.util.StringTokenizer;
    import java.net.URL;
    public class WorldMapTest {
        public static void main(String[] args) throws Exception {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();
            SimpletonPathExtractor handler = new SimpletonPathExtractor();
            saxParser.parse(new URL("http://upload.wikimedia.org/wikipedia/commons/b/b7/World98.svg").openStream(), handler);
            createAndShowGUI(handler.locations);
        public static void createAndShowGUI(final java.util.List<Location> locations) {
            JFrame frame = new JFrame();
            JPanel p = new JPanel() {
                @Override
                public Color getBackground() {
                    return Color.white;
                public void paintComponent(java.awt.Graphics g) {
                    super.paintComponent(g);
                    Graphics2D g2 = (Graphics2D) g;
                    g2.scale(getWidth() / 8000.0, getHeight() / 3859.0);
                    g2.setColor(Color.black);
                    Point p = getMousePosition();
                    if(p != null) {
                        p.x = (int) (p.x * 8000/getWidth());
                        p.y = (int) (p.y * 3859/getHeight());
                    String placeID = null;
                    for (Location loc : locations) {
                        if(p != null && placeID == null && loc.boundry.contains(p)){
                            g2.setColor(Color.LIGHT_GRAY);
                            g2.fill(loc.boundry);
                            placeID = loc.id == null?"Unkown":loc.id;
                            g2.setColor(Color.black);
                        g2.draw(loc.boundry);
                    if (placeID != null) {
                        g2.setColor(Color.green.darker());
                        Font f = g2.getFont();
                        f = f.deriveFont(Font.BOLD,(f.getSize() * 8000f / getWidth()));
                        g2.setFont(f);
                        g2.drawString(placeID, p.x, p.y);
                public java.awt.Dimension getPreferredSize() {
                    return new Dimension(1000,482);
            p.addMouseMotionListener(new java.awt.event.MouseAdapter() {
                @Override
                public void mouseMoved(java.awt.event.MouseEvent e) {
                    ((JComponent) e.getSource()).repaint();
            frame.setContentPane(new JScrollPane(p));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        public static class SimpletonPathExtractor extends DefaultHandler {
            java.util.List<Location> locations = new java.util.ArrayList<>();
            String recentID;
            @Override
            public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
                if("g".equals(qName)) {
                    recentID = attr.getValue("id");
                if ("path".equals(qName)) {
                    int length = attr.getLength();
                    for (int i = 0; i < length; i++) {
                        String attrN = attr.getQName(i);
                        String val = attr.getValue(attrN);
                        if ("d".equals(attrN)) { //path data
                            Path2D path = new Path2D.Double();
                            //assume simple polygonal path
                            StringTokenizer tk = new StringTokenizer(val, "MLzZ ");
                            try {
                                path.moveTo(Double.parseDouble(tk.nextToken()),
                                            Double.parseDouble(tk.nextToken()));
                                while (tk.hasMoreTokens()) {
                                    path.lineTo(Double.parseDouble(tk.nextToken()),
                                                Double.parseDouble(tk.nextToken()));
                                path.closePath();
                            } catch (Exception e) {
                                throw new Error("I'm a simple parser. I can only do "
                                        + "'LineTo' paths!", e);
                            locations.add(new Location(path,recentID));;
            public void endElement(String uri, String localName, String qName) throws SAXException {
                if("g".equals(qName)) {
                    recentID = null;
        public static class Location {
            Path2D boundry;
            String id;
            public Location(Path2D boundry, String id) {
                this.boundry = boundry; this.id = id;
    }

  • Result Set problem!!!Plz urgent

    Hi,
    I am using jsp page with database connection.In jsp page i have two button called move next and move previous.
    In database 2 records are there.If i open the jsp page first record will be displayed.If i click next record it showing 2nd record.If i click previous record it showing 1st record.Once again if i click next record it is showing that record not found...........What may be the problem????.
    Note:For each time button click i will pass the result set object in session variable.Whether it is a correct one..
    Plzz help me ya...........

    this is for move next:::
    ResultSet result=null;
    Connection connection=null;
    String candyid="";
    result = (ResultSet)session.getAttribute("resget");
    result.next();
    if(!result.next())
    %>
    <Script>
    alert("Record Not Found");
    </Script>
    <%
    result.previous();
    candyid=result.getString(1);
    session.setAttribute("resget",result);
    %>
    <input type=hidden name="hide" value="yes">
    <input type=hidden name="nextid" value=<%= candyid %>>
    <Script>
    document.AddCandetails2.action="modifyCandidate1.jsp";
    document.AddCandetails2.submit();
    </Script>
    <%
    else
    candyid=result.getString(1);
    System.out.println("candi next id"+candyid);
    session.setAttribute("prevresget1",result);
    System.out.println("resultset for set attar in next"+result);
    %>
    <input type=hidden name="hide" value="yes">
    <input type=hidden name="nextid" value=<%= candyid %>>
    <Script>
    document.AddCandetails2.action="modifyCandidate1.jsp";
    document.AddCandetails2.submit();
    </Script>
    <%
    this is for move previous:::
    ResultSet result=null;
    Connection connection=null;
    String candyid="";
    if(session.getAttribute("prevresget1")==null)
    result = (ResultSet)session.getAttribute("resget");
    else
    result = (ResultSet)session.getAttribute("prevresget1");
    if(!result.previous())
    %>
    <Script>
    alert("Record Not Found");
    </Script>
    <%
    result.next();
    candyid=result.getString(1);
    session.setAttribute("resget",result);
    %>
    <input type=hidden name="hide" value="yes">
    <input type=hidden name="nextid" value=<%= candyid %>>
    <Script>
    document.AddCandetails2.action="modifyCandidate1.jsp";
    document.AddCandetails2.submit();
    </Script>
    <%
    else
    candyid=result.getString(1);
    session.setAttribute("prevresget1",result);
    %>
    <input type=hidden name="hide" value="yes">
    <input type=hidden name="nextid" value=<%= candyid %>>
    <Script>
    document.AddCandetails2.action="modifyCandidate1.jsp";
    document.AddCandetails2.submit();
    </Script>
    <%
    this is the code............... can u give me the solution

  • Working with result set i need a solution..... plz treat it as urgent

    i have a query which returns 12 records so the result set contains 12...
    now i want to display in the set of 5 rows... so
    out put must me
    Name Rate Name Rate Name Rate
    1 6 11
    2 7 12
    3 8
    4 9
    5 10
    how can i achieve this output...
    I guess this will clear the question......

    You create a for loop that indexes from 1 to 5. You get a row(item) from the result each time through the loop. You all check next() and break out of the loop when it returns false.

  • Problem in creating Saved Result Set (SRS) in OBIEE 10.1.3.4

    Hi,
    We have migrated Siebel Analytincs 7.8.5 to OBIEE 10.1.3.4, and we are now unable to create any SRS from OBIEE though we can create Segment and marketing cache for the segment.
    We did the following steps -
    1. Unisntall Siebel Analytincs 7.8.5
    2. Install OBIEE 10.1.3.4
    3. Use MIGRATE tool (sawmigrate) to migrate RPD & WEBCAT
    4. We have ALTERed the SRS tables - M_SR_HEADER, M_SR_ACCOUNT (as in OBIEE version there are many new columns have been added)
    5. We passed GLOBAL CONSISTENCY in the RPD
    6. We followed the steps in the document *"Oracle®Marketing Segmentation Guide Version 10.1.3.4 July 2008"*
    7. We created a Saved Result Set Format as instructed in the document - here we are very confused to select the list of columns - we don't know what should be the excat source / format
    8. Then we click the SRS create button
    9. We got the below error -
    Error Codes: QS2QOLYY:GDL67CY9:IHVF6OM7:OPR4ONWY:U9IM8TAC
    Error in getting cursor for WorkNode (Id:0)
    Authentication Failure.
    Odbc driver returned an error (SQLDriverConnectW).
    *State: 08004. Code: 10018. [NQODBC] [SQL_STATE: 08004] [nQSError: 10018] Access for the requested connection is refused. [nQSError: 43001] Authentication failed for Administrator in repository Star: invalid user/password. (08004)*
    Can anyone help us to resolve the issue ?
    A quick response is much much appreciated.
    Many Thanks,
    Prasanta

    Hi,
    It seems like you didnt setup the Administrator user for Saved Result Sets as it mentioned in the Marketing Segmentation Guide.
    Here is an extract from the guide:
    Setting Up the Web Administrator for Managing Cache and Saved Result Sets
    Some queries issued by the segmentation engine require the use of the Execute Physical stored
    procedure. These queries include delete statements on the cache, delete statements on the saved
    result sets, and insert statements for the cache and saved result set. The Execute Physical stored
    procedure must be run by a user with administrator privileges. The administrator user is set up in
    the instanceconfig.xml file.
    NOTE: The BI Administrator password and login parameters are case sensitive.
    To set up the administrative user in the instanceconfig.xml file
    1 Open a command shell and navigate to the <OracleBI>/web/bin, where <OracleBI> represents
    the root directory of the installation.
    2 Execute the following command:
    cryptotools credstore -add -infile <OracleBIData>/web/config/credentialstore.xml
    3 When prompted, enter the following values:
    Credential Alias: admin
    Username: Administrator
    Password: <enter Admin password here>
    Do you want to encrypt the password? y
    Passphrase for encryption: <password >
    Do you want to write the passphrase to the xml? n
    File "<OracleBIData>/web/config/credentialstore.xml" exists. Do you want to overwrite it? y
    4 Open the credentialstore.xml file and verify that the following section has been created:
    <sawcs:credential type="usernamePassword" alias=“admin">
    <sawcs:username> Administrator </sawcs:username>
    <sawcs:password>
    <xenc:EncryptedData>

  • Result Set fetch agonisingly slow

    I am having sporadic trouble retrieving data from a ResultSet. I do not know how to tell if it is an Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some result sets it pauses for several seconds after every 10 iterations. This usually causes a webserver time-out and the results never get to the browser. It is NOT volume related, as some LARGER result sets from almost identical queries (i.e. with just one value in the where clause changed) run fine. We are using Oracle 8i, and the "problem" query always runs fine in SQLPlus (i.e. less than ten seconds for the execution and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is pretty quick - just a few seconds at worst
    b) All result sets from this query pause every 10 iterations, but most pause for just a fraction of a second
    c) With a certain value in the where clause, the pauses are 4-30 seconds, which, even when only ~700 rows are returned, results in a response time of several minutes.
    d) The pauses are in the results.next() statement itself (I have output timestamps at the very beginning and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is: AND FULFILLER.NAME IN (...) , where the IN clause can contain single or multiple names (but I am using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and that index IS being used (according to "EXPLAIN PLAN") in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I would have thought that the values in the where clause would only affect the creation of the ResultSet, and not the reading of that result set. Am I wrong? Any ideas anyone?
    Thanks,
    Martin Reynolds (renozu)

    I am having sporadic trouble retrieving data from a
    ResultSet. I do not know how to tell if it is an
    Oracle problem or a JDBC problem.
    In a while( results.next() ) loop, for some
    result sets it pauses for several seconds after every
    10 iterations. This usually causes a webserver
    time-out and the results never get to the browser. It
    is NOT volume related, as some LARGER result sets from
    almost identical queries (i.e. with just one value in
    the where clause changed) run fine. We are using
    Oracle 8i, and the "problem" query always runs fine in
    SQLPlus (i.e. less than ten seconds for the execution
    and display of ~700 rows).
    some relevant evidence:
    a) Usually the PreparedStatement.execute() itself is
    pretty quick - just a few seconds at worst
    b) All result sets from this query pause every
    10 iterations, but most pause for just a fraction of a
    second
    c) With a certain value in the where clause, the
    pauses are 4-30 seconds, which, even when only ~700
    rows are returned, results in a response time of
    several minutes.
    d) The pauses are in the results.next() statement
    itself (I have output timestamps at the very beginning
    and the very end of the loop to show this).
    e) the query is a join of six tables
    f) the part of the where clause that changes is:
    AND FULFILLER.NAME IN (...) , where the IN
    clause can contain single or multiple names (but I am
    using a single value in the "problem" query)
    g) The FULFILLER.NAME column IS an indexed field, and
    that index IS being used (according to "EXPLAIN PLAN")
    in both the fast queries and the slow queries.
    What confuses me (amongst several things) is this: I
    would have thought that the values in the where clause
    would only affect the creation of the
    ResultSet, and not the reading of that result
    set. Am I wrong? Any ideas anyone?
    this honestly doesn't HAVE to be the case... depending on the cursor.
    i think if one has a forward only cursor the database could figure it out as it scans along the table. it should be fater in fact because if it does like this you only do one table scan and not two. this theory seems to fall apart when you say it is using the index BUT if I was writing a database and you had a forward only cursor AND the distribution of keys in the index indicated that there were many rows that would match your query I might ignore the index and do it as described.
    so call me crazy but here is my suggestion...
    if the cursor you are using is a forward only cursor then try a scrollable cursor.
    if it is already a scrollable cursor or changing it didn't help then try this...
    rs.last();
    rs.beforeFirst();
    // now process normally using next()i would think that this would force the database to find all the rows.... so it should help.
    also the server timeout issue will sort of need to be addressed also if the query still takes a long time to run...
    Thanks,
    Martin Reynolds (renozu)

  • Result set null

    Hello techies,
    I am doing simple program, which is connecting to mysql server and retreiving the results from my database using servlets.
    I want to do if the result set is returning zero rows i.e if there is no matching rows is available in the table, which i had specified in my query.
    Here is my code
    String url = "jdbc:odbc:testDSN";
    Properties p = new Properties();
    p.put("user", "root");
    p.put("password", "kkkk");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection(url, p);
    System.out.println("connection established");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select *from test.emp where empNumber =15");
    System.out.println("resultset is null" + rs.wasNull());
    if (rs.getRow() == 0) {
    System.out.println("nomatching subject is found");
    out.println("No Matching subject is found");
    else {
    out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
    out.println("<TR><TH>eno</TH><TH>ename</TH><TH>date</TH></TR>");
    // Loop through results of query.
    while (rs.next() == true)
    out.println("<TR>");
    out.println("<TD>" + rs.getString("eno")+ "</TD>");
    out.println("<TD>" + rs.getString("ename") + "</TD>");
    out.println("<TD>" + rs.getString("date") + "</TD>");
    out.println("</TR>");
    Here if there are no employe record matching eno =15 in my table then i want to print no matching record is found.
    where i am making mistake??
    plz help me .
    It is very urgent.
    Thanks (inadvance)
    regards,
    ramu

    Good Lord, you have database and HTML generation code in the same method?
    This is not the way to do JDBC code. Start with a tutorial.
    Ever read about object-oriented programming? How 'bout starting with an Employee class that has id, name, and date (what date? birth date? employment date? termination date?) as attributes. Then write a data access object that can do all the database stuff on Employee's behalf, without any consideration for UI. Test that on the command line until you have it working perfectly. THEN worry about how you'll display results to the user.
    Your JDBC code isn't right. wasNull() checks to see if the column result is null, not the result set itself. (ResultSet can never be null; read the javadocs). You'd be getting a NullPointerException if ResultSet was null, wouldn't you?
    Your code deserves a SERIOUS rewrite, which I'm not inclined to do for you. But I would recommend something more along these lines:
    // hardwired url, driver, and query?  oh, my - that's bad.
    String url = "jdbc:odbc:testDSN";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection(url);
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select * from emp where empNumber =15");
    // you're obviously putting this in a servlet - bad idea.
    // ever heard of JSPs?
    out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
    out.println("<TR><TH>eno</TH><TH>ename</TH><TH >date</TH></TR>");
    // Loop through results of query.
    while (rs.next())
    out.println("<TR>");
    out.println("<TD>" + rs.getString("eno")+ "</TD>");
    out.println("<TD>" + rs.getString("ename") + "</TD>");
    out.println("<TD>" + rs.getString("date") + "</TD>");
    out.println("</TR>");
    }%

  • Getting message : The result set for this selection was empty on sm20

    Hi,
       I assigned below parameters in rz10 :
    rsau/user_selection                                 1
    rsau/max_diskspace/per_day                  1950M
    rsau/max_diskspace/per_file                 650M
    rsau/enable                                               1
       I activated security audit profile in sm19 also.But when iam going to sm20 for analysis of security audit log iam not getting report iam getting this message  :     The result set for this selection was empty.
    Gudie me for the same.
    Thanku

    Hi,
    The result set for this selection was empty.
    I think your configuration is OK except one thing...
    Check in SM19, if you have selected "Filter Active" check box in "Filter 1 and Filter 2" screen and Also "Audit Classess".
    Even though security audit is enabled in SM19, without selecting filter it will not log the events and give you the above message.
    Regards.
    Rajesh Narkhede

  • Put database result set into a vector?

    I have a resultset rs I would like to put into a vector but I don't seem to get something fundamental. I can put individual items in with add() for instance but how do I dump a whole result set in there...
    and if I do so should I turn them all to strings before putting them into the vector?
    Any general advice would be appreciated, I've read a lot about Vectors today and have ended up more confused than I'd have expected. So I have come to seek some basic advice.
    private static void showResult (ResultSet rs) throws SQLException {
                            Vector vector = new Vector();
             try
                     // rs is the resultset output from a database
                                      vector.addAll(rs);
             catch(NullPointerException ex)
                    System.out.println("bugger - null pointer exception");
                    System.out.println();
                    ex.printStackTrace();
    }

    Iterate over the resultset, create your own object to store data for each row and add that object to the vector. There is no escape from this.
    catch(NullPointerException ex)You should not be handling Runtime exceptions. You need to take care not to let them occur through your coding logic.

  • Result set two few parameters exception!!?

    when i use the following code:
           res = stat1.executeQuery("SELECT * FROM Word where word="+current );
    where res is a result set
    stat1 is a statement
    current is a string
    the following exception appears after running:
    java.sql.sqlexception[microsoft][ODBC microsoft access Driver] Two few parameters.Expected 1.
    Any one can help me with this problem plz?

    is the (?) from the syntax?in:
    PreparedStatement ps =
    connection.prepareStatement("SELECT * FROM Word WHERE
    word=?");
    ps.setString(1, someWord);
    rs = ps.executeQuery(); [url http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html#JDBC207]http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html#JDBC207

  • How to execute entire result set of multiple sql statements via sp_executesql?

    I have a query that generates multiple insert statements (dynamic sql).  So when I execute this my result set is a table of sql insert statements (one insert statment per row in my source data table).  Like so:
                 Select 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' +  SrcData + ')' from SourceDataTbl
    How can I completely automate this and execute all these sql statements via sp_executesql?
    My plan is to completely automate and execute all this via an SSIS package.
    As always any help is greatly appreciated!
    fyi-  This is a very simple version of what I am trying to do.  My query probably plugs in 20+ values from the SourceDataTbl into each of the sql insert statements.

    Ah, a small error in Visakh's post, which I failed to observe, and then I added one on my own.
    DECLARE @SQL Varchar(max)
    SELECT @SQL =
       (SELECT 'INSERT INTO [dbo].[Table_1] ([Col1]) VALUES (' +  SrcData +
                ')' + char(10) + char(13)
        from SourceDataTbl
        FOR XML PATH(''), TYPE).value('.', 'nvarchar(max)')
    EXEC sp_executesql @SQL
    Without ", TYPE" FOR XML returns a string when assigned to a variable. The TYPE thing produces a value of the XML data type, so that we can apply the value method and get string out of the XML.
    And why this? Because:
    DECLARE @str nvarchar(MAX)
    SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''))
    SELECT @str
    SELECT @str = (SELECT 'Kalle Anka & co' FOR XML PATH(''), TYPE).value('.', 'nvarchar(MAX)')
    SELECT @str
    Although the data type is string when , TYPE is not there, it is still XML and characters special to XML are enticised.
    Confused? Don't worry, for what you are doing, this is mumbo-jumbo.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Map result set elements to XML

    Hi,
    Iam retrieving fields from data base in to a result set.Iam creating an xml file using the result set fields by passing the column names as xml tags.the xml file is generated and working fine.But i wanted to add custom tags instead of column names in my xml files.
    is there any way to map the fields with my custom tag names?
    Thanks,
    Ravi

    I know that the site below does not cover exactly what you want but you can customize the code snippets to your needs. All you have to do is to devise a suitable algorithm to avoid the repetition of sibling elements having the same text. With regard to this requirement I advise you to order the records in the ResultSet before processing them because it makes the comparison of the records (which is unavoidable to find the repetitive values) much easier.
    http://www.developer.com/db/article.php/3329001

  • How to Colour the fields in the Result Set of the query

    Hi all,
    I am having a requirement wher the user want to view the queries results with some colour to the char in the result set.
    suppose customer is the row he want to view some customers with one color and some with different color.
    Is it possible in Bi.
    If so Plz let me know
    Regards

    Hi Priya,
    for the macro thing, you will have to create a workbook and store your query into it, because macros are attached to only workbooks and not queries.
    in the workbook screen (i.e. excel), go to tools --> Macro --> Visual Basic Editor. or simply press Alt + F11. this will take you to macro editor screen.
    you can use code that may look something like below to color the columns, you can also give constant column if they are fixed.
    sub ColorColumns(rngTarget As Range, _
        intColor As Integer)
    Dim c As Long
        With rngTarget
            .Interior.ColorIndex = intColour
            Next c
        End With
    End Sub
    You will find some easy and short snippets for this.
    Regards,
    Purvang

  • Client side result set cache

    Hello,
    I try to get the client side result set cache working, but i have no luck :-(
    I'm using Oracle Enterprise Edition 11.2.0.1.0 and as client diver 11.2.0.2.0.
    Executing the query select /*+ result_cache*/ * from p_item via sql plus or toad will generate an nice execution plan with an RESULT CACHE node and the v$result_cache_objects contains some rows.
    After I've check the server side cache works. I want to cache the client side
    My simple Java Application looks like
    private static final String ID = UUID.randomUUID().toString();
    private static final String JDBC_URL = "jdbc:oracle:oci:@server:1521:ORCL";
    private static final String USER = "user";
    private static final String PASSWORD = "password";
    public static void main(String[] args) throws SQLException {
    OracleDataSource ds = new OracleDataSource();
    ds.setImplicitCachingEnabled(true);
    ds.setURL( JDBC_URL );
    ds.setUser( USER );
    ds.setPassword( PASSWORD );
    String sql = "select /*+ result_cache */ /* " + ID + " */ * from p_item d " +
    "where d.i_size = :1";
    for( int i=0; i<100; i++ ) {
    OracleConnection connection = (OracleConnection) ds.getConnection();
    connection.setImplicitCachingEnabled(true);
    connection.setStatementCacheSize(10);
    OraclePreparedStatement stmt = (OraclePreparedStatement) connection.prepareStatement( sql );
    stmt.setLong( 1, 176 );
    ResultSet rs = stmt.executeQuery();
    int count = 0;
    for(; rs.next(); count++ );
    rs.close();
    stmt.close();
    System.out.println( "Execution: " + getExecutions(connection) + " Fetched: " + count );
    connection.close();
    private static int getExecutions( Connection connection ) throws SQLException {
    String sql = "select executions from v$sqlarea where sql_text like ?";
    PreparedStatement stmt = connection.prepareStatement(sql);
    stmt.setString(1, "%" + ID + "%" );
    ResultSet rs = stmt.executeQuery();
    if( rs.next() == false )
    return 0;
    int result = rs.getInt(1);
    if( rs.next() )
    throw new IllegalArgumentException("not unique");
    rs.close();
    stmt.close();
    return result;
    100 times the same query is executed and the statement exection count is incemented every time. I expect just 1 statement execution ( client database roundtrip ) and 99 hits in client result set cache. The view CLIENT_RESULT_CACHE_STATS$ is empty :-(
    I'm using the oracle documentation at http://download.oracle.com/docs/cd/E14072_01/java.112/e10589/instclnt.htm#BABEDHFF and I don't kown why it does't work :-(
    I'm thankful for every tip,
    André Kullmann

    I wanted to post a follow-up to (hopefully) clear up a point of potential confusion. That is, with the OCI Client Result Cache, the results are indeed cached on the client in memory managed by OCI.
    As I mentioned in my previous reply, I am not a JDBC (or Java) expert so there is likely a great deal of improvement that can be made to my little test program. However, it is not intended to be exemplary, didactic code - rather, it's hopefully just enough to illustrate that the caching happens on the client (when things are configured correctly, etc).
    My environment for this exercise is Windows 7 64-bit, Java SE 1.6.0_27 32-bit, Oracle Instant Client 11.2.0.2 32-bit, and Oracle Database 11.2.0.2 64-bit.
    Apologies if this is a messy post, but I wanted to make it as close to copy/paste/verify as possible.
    Here's the test code I used:
    import java.sql.ResultSet;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.OracleConnection;
    class OCIResultCache
      public static void main(String args []) throws SQLException
        OracleDataSource ods = null;
        OracleConnection conn = null;
        PreparedStatement stmt = null;
        ResultSet rset = null;
        String sql1 = "select /*+ no_result_cache */ first_name, last_name " +
                      "from hr.employees";
        String sql2 = "select /*+ result_cache */ first_name, last_name " +
                      "from hr.employees";
        int fetchSize = 128;
        long start, end;
        try
          ods = new OracleDataSource();
          ods.setURL("jdbc:oracle:oci:@liverpool:1521:V112");
          ods.setUser("orademo");
          ods.setPassword("orademo");
          conn = (OracleConnection) ods.getConnection();
          conn.setImplicitCachingEnabled(true);
          conn.setStatementCacheSize(20);
          stmt = conn.prepareStatement(sql1);
          stmt.setFetchSize(fetchSize);
          start = System.currentTimeMillis();
          for (int i=0; i < 10000; i++)
            rset = stmt.executeQuery();
            while (rset.next())
            if (rset != null) rset.close();
          end = System.currentTimeMillis();
          if (stmt != null) stmt.close();
          System.out.println();
          System.out.println("Execution time [sql1] = " + (end-start) + " ms.");
          stmt = conn.prepareStatement(sql2);
          stmt.setFetchSize(fetchSize);
          start = System.currentTimeMillis();
          for (int i=0; i < 10000; i++)
            rset = stmt.executeQuery();
            while (rset.next())
            if (rset != null) rset.close();
          end = System.currentTimeMillis();
          if (stmt != null) stmt.close();
          System.out.println();
          System.out.println("Execution time [sql2] = " + (end-start) + " ms.");
          System.out.println();
          System.out.print("Enter to continue...");
          System.console().readLine();
        finally
          if (rset != null) rset.close();
          if (stmt != null) stmt.close();
          if (conn != null) conn.close();
    }In order to show that the results are cached on the client and thus server round-trips are avoided, I generated a 10046 level 12 trace from the database for this session. This was done using the following database logon trigger:
    create or replace trigger logon_trigger
    after logon on database
    begin
      if (user = 'ORADEMO') then
        execute immediate
        'alter session set events ''10046 trace name context forever, level 12''';
      end if;
    end;
    /With that in place I then did some environmental setup and executed the test:
    C:\Projects\Test\Java\OCIResultCache>set ORACLE_HOME=C:\Oracle\instantclient_11_2
    C:\Projects\Test\Java\OCIResultCache>set CLASSPATH=.;%ORACLE_HOME%\ojdbc6.jar
    C:\Projects\Test\Java\OCIResultCache>set PATH=%ORACLE_HOME%\;%PATH%
    C:\Projects\Test\Java\OCIResultCache>java OCIResultCache
    Execution time [sql1] = 1654 ms.
    Execution time [sql2] = 686 ms.
    Enter to continue...This is all on my laptop, so results are not stellar in terms of performance; however, you can see that the portion of the test that uses the OCI client result cache did execute in approximately half of the time as the non-cached portion.
    But, the more compelling data is in the resulting trace file which I ran through the tkprof utility to make it nicely formatted and summarized:
    SQL ID: cqx6mdvs7mqud Plan Hash: 2228653197
    select /*+ no_result_cache */ first_name, last_name
    from
    hr.employees
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute  10000      0.10       0.10          0          0          0           0
    Fetch    10001      0.49       0.54          0      10001          0     1070000
    total    20002      0.60       0.65          0      10001          0     1070000
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 94 
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
           107        107        107  INDEX FULL SCAN EMP_NAME_IX (cr=2 pr=0 pw=0 time=21 us cost=1 size=1605 card=107)(object id 75241)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                   10001        0.00          0.00
      SQL*Net message from client                 10001        0.00          1.10
    SQL ID: frzmxy93n71ss Plan Hash: 2228653197
    select /*+ result_cache */ first_name, last_name
    from
    hr.employees
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0         11         22           0
    Fetch        2      0.00       0.00          0          0          0         107
    total        4      0.00       0.01          0         11         22         107
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 94 
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
           107        107        107  RESULT CACHE  0rdkpjr5p74cf0n0cs95ntguh7 (cr=0 pr=0 pw=0 time=12 us)
             0          0          0   INDEX FULL SCAN EMP_NAME_IX (cr=0 pr=0 pw=0 time=0 us cost=1 size=1605 card=107)(object id 75241)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      log file sync                                   1        0.00          0.00
      SQL*Net message from client                     2        1.13          1.13The key differences here are the execute, fetch, and SQL*Net message values. Using the client-side cache, the values drop dramatically due to getting the results from client memory rather than round-trips to the server.
    Of course, corrections, clarifications, etc. welcome and so on...
    Regards,
    Mark

  • BW Web Report Issue - Result set too large

    Hi,
    When I execute a BEx Query on Web I am getting “Result set too large ; data retrieval restricted by configuration (maximum = 500000 cells)”.
    Following to my search in SDN I understood we can remove this restriction either across the BW system globally or for a specific query at WAD template.
    In my 7x Web template I am trying to increase default max no of rows parameters, As per the below inputs from SAP Note: 1127156.
    But I can’t find parameter “Size Restriction for Result Sets” for any of the web items (Analysis/Web Template properties/Data Provider properties)….in the WAD Web template
    Please advise where/how can I locate the properites
    Instructions provided in SAP Note…
    The following steps describe how to change the "safety belt" for Query Views:
    1. Use the context menu Properties / Data Provider in a BEx Web Application to maintain the "safety belt" for a Query View.
    2. Choose the register "Size Restriction for Result Sets".
    3. Choose an entry from the dropdown box to specify the maximum number of cells for the result set.
                  The following values are available:
    o Maximum Number
    o Default Number
    o Custom-Defined Number
                  Behind "Maximum Number" and "Default Number" you can find the current numbers defined in the customizing table RSADMIN (see below).
    4. Save the Query View and use it in another Web Template.
    Thanks in advance

    Hi Yasemin,
    Thanks for all help...i was off couple of days.
    To activate it I can suggest to create a dummy template, add your query in it, add a menu bar component add an action to save the query view. Then you run the template and change the size restriction for result set then you can save it by the menu.
    Can you please elaborate on the solution provided,I created dummy template with analysis and Menu bar item...i couldn't able to configure menu bar item...
    Thanks in advance

Maybe you are looking for

  • SQL Server Agent Jobs error for Slowly changing dimension

    Hi, I have implemented Slowly changing dimension in 5 of my packages for lookup insert/update. All the packages are running good in SSDT. And when i deployed the project to SSISDB and run the packages all are running successfully. But when i created

  • How can I connect iMac (2008) to Cintiq Companion?

    I have iMac since 2008 and this year I was given Cintiq Companion II. Actually I already had the problem with connection with another Cintiq (had to return it in the end) - they have cables that  simply don't fit iMac and I have no idea what adaptor

  • T it insta

    I have just installed Aperture 2. I have dragged folders from my pro to an external hard drive to copy them. If I now look in the aperture libraries the folders are there and all the content within them. But when I open Aperture to view them I am loo

  • What is the best display setting to use with a sanyo projector for Mac OS x 10.8.3

    What is the best display setting to use with a sanyo projector for Mac OS x 10.8.3

  • Qosmio x505-q870 system recovery?

    How to I restore back to factory, I been trying to figure this out for a couple of days, but I get now where. I have make to 5 disc required twice. but i dont know how to do it. I tried the advance recovery in the control pannel but I get error messa