Problem in setting the resultset recordset

hi all,
i am trying to do paging in my website .. i want to set the records fetched from the resultset...i am using the "rs.setFetchSize(3)"
i want to show only 3 records per page...
code is shown below.. problem is it is showing
"java.sql.SQLException: Invalid Fetch Size"
exception.... please help me out...
package demo;
import java.sql.*;
public class fetchrecord {
     public static void main(String[] args) {
          Connection con =null;
          try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con=DriverManager.getConnection("jdbc:odbc:chandan");
          Statement st=con.createStatement();
          String q1="Select * from Table1";
          ResultSet rs=null;
          rs=st.executeQuery(q1);
          rs.setFetchSize(3);
          System.out.println("Details are as follows");
     System.out.println("\n");
          while(rs.next())
          String Name = rs.getString(1);
          String School = rs.getString(2);
          System.out.print(Name+" ");
          System.out.print(School);
          System.out.println("\n");
          }catch(Exception e)
          System.out.println(e);
          try {
          con.close();
          catch (SQLException e)
          e.printStackTrace();
thanks
chandan sharma

as per the api documentation, an exception occurs when the condition 0 <= rows <= Statement.getMaxRows() is not satisfied

Similar Messages

  • Problem in setting the smtp in a apple mail account.

    Can anyone help me resolve a problem in setting the mail preferrences? I have multiple email accounts and the smtp address is being deleted to a none smtp in an account then when I fix the problem in one account it deletes an smtp address in another email account. When I fix that account it deletd another smtp address and so on an so forth. Is this a virus or is there a fix for this problem?

    Mail in IOS iPhone or OS X?
    Anyway You select each account and assign or create new smtp.

  • Problem while setting the selected value of h:selectOneMenu to bean

    Hi all,
    I am new to JSF. I am working on application where i have combo boxe on the page. I am setting some values to the combobox from database using <f:selectItems> tag and one value using <f:selectItem> tag. The value combobox value selected by user is set to the bean property which is String. I am able to display all the values in the combobox but when clicked on button (present at the end of form) i am getting following error-
    ERROR HtmlRendererUtils:354 - Error finding Converter for
    component with id interviewStageOneForm:acceptanceChannelList
    I am setting the combobox selected value to the to the bean property which is String and the value selected in also String. Then which converter it is asking for. I am not able to find out what is the problem.
    Your suggestions will be really appreciated.
    Here is my code snippet:-
    JSF:-
    <h:selectOneMenu id="acceptanceChannelList"
         value="#{interviewStageOneBean.index}">
         <f:selectItem itemValue="Select" itemLabel="#{Message.combo_select}" />
         <f:selectItems value="#{MasterDataBean.acceptanceChannelList}" />  <!-- The list coming from database-->
    </h:selectOneMenu>Bean:-
    public class InterviewStageOneBean {
         private String index;
         public String getIndex() {
              return index;
         public void setIndex(String index) {
              this.index = index;
    }

    Hi!
    First I would try next:
    Try to leave out
    <f:selectItem itemValue="Select" itemLabel="#{Message.combo_select}" />
    line. And check if it works after that. If it didn't repeat step but you leave in message selectItem and dump out database selectItem line.
    Second:
    I would check acceptanceChannelList creation and what type of objects you put while doing setValue and setLabel on UISelectItem
    Probably selectItem value has been assigned an object of type the engine doesn't know how to convert from String to it.

  • Problem in setting the parameters for an OASingleSelectionBean

    Hi,
    I have created an advanced table, for which I have to allow single selection or mutliple selection according to my requirements ie dynamically. So, for single selection, I have created a OASingleSelectionBean dynamically and add this to my advanced table bean.
    I also want to set Action for the single selection option. I have set the action using
    setPrimaryClientAction() which takes an argument of oracle.cabo.ui.action.FirePartialAction class. Now I also want to pass certain parameters when the single selection event happens.
    For that, I have taken an object of FirePartialAction class and but using the FirePartialAction class .setParameters(oracle.cabo.ui.collection.Parameter[]) function. I am setting the parameters using
    Parameter class object.setKey
    Parameter class object.setValue
    But my problem is that I want the value for the parameters at runtime, for which I intend to use SPEL. But I am not able to use SPEL using the setValue method.
    So it goes like this in short:
    OAAdvancedTableBean.setTableSelection(OASingleSelectionBean)
    OASingleSelectionBean.setPrimaryClientAction(FirePartialAction)
    FirePartialAction.setParameters(Parameter[])
    Parameters.setKey(String)
    Parameters.setValue(String) --- In case of value I want to give SPEL as an argument as I get the value at rutime
    Is that any other way in which I can set the value for the parameters using SPEL?

    Hi,
    I got ur point.
    Although i have never tried.........Can you try using method
    Parameters.setValueBinding(new OADataBoundValueViewObject(<single selectionbean>,<vo attr>))
    In this way without the use of SPEL, you will be able to achieve the functionality!
    Try this and get back to me!
    --Mukul
    Message was edited by:
    Mukul Gupta

  • Problem in setting the target property to _SELF of LinkToURL UI Element

    Hi,
    I have a LinkToURL UI Element in my web page which has to open up another page in the same window.
    I tried setting the target property to _SELF, but it's not working.Instead the page is opened in a new child window.
    Please tell me whether to set any other property to get that.
    Thanks and Regards,
    Padma Usha.

    Hi,
    Please give the target value in lowercase "_self".
    Regards, Anilkumar

  • Problem in setting the background color of jtable with Nimbus

    Hi
    I have created a java swing application. In which I am using JTable.
    When creating a simple JTable and displaying with Nimbus, the row background color alternates between white and a light blue-grey.
    I want the table with single colour. Only the first column should be grey colour and other should be white.
    I used this code to set the background and foreground colour.
    public Component prepareRenderer
        (TableCellRenderer renderer, int index_row, int index_col){      
                Component objComponent = super.prepareRenderer(renderer, index_row, index_col);         
                Color objGreyColour = new Color(240,240,240);
                Color objWhiteColour = new Color(255,255,255);
                if(index_col == 0){
                    objComponent.setBackground(objGreyColour);
                    objComponent.setFont(new java.awt.Font(CommonClass.getFontName(),java.awt.Font.BOLD, CommonClass.getFontSize()));
                    objComponent.setForeground(Color.BLACK);
                }else{               
                    setSelectionBackground(Color.BLUE);
                    objComponent.setBackground(objWhiteColour);
                    objComponent.setForeground(Color.BLACK);
                return objComponent;
            } Look wise it is fine but when i try to select the cell it is not highlighting the cell and also i m not able to select multiple cell with ctrl key.
    Any help would be appreciated
    Thanks
    Sonal

    Hello,
    1) if you want better help soone,r please post an SSCCE (http://sscce.org) instead of a code extract.
    2) selection highlighting is lost because your code... doesn't handle selection. To take selection into account, you can use <tt>if (super.isRowselected(index_row)) {...}</TT>.
    Regards,
    J.

  • Problem while setting the property of column in ALV

    Hi ,
    I have created a alv dynamically and setting the properties of the column like column header text but its not getting updated .
    see the below code for ref.
    lr_column_settings ?= lr_config_table.
      data:
        lt_columns type salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
      data: lr_column      type ref to cl_salv_wd_column,
        lr_header      type ref to cl_salv_wd_column_header,
        ls_column type salv_wd_s_column_ref.
      loop at lt_columns into ls_column.
        case ls_column-id.
          when 'MOIST'.
            lr_column = ls_column-r_column.
        lr_header = lr_column->get_header( ).
        lr_header->set_text( 'Moisture %' ).
    I am able to set the alv properties like  visible row count etc ..
    can anybody help out in this issue
    Regards
    Yash

    I was just able to change my headers with the following:
    data:
        lt_columns     type salv_wd_t_column_ref,
        ls_column      type salv_wd_s_column_ref,
        lr_header      type ref to cl_salv_wd_column_header.
      lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).
      loop at lt_columns into ls_column.
        lr_column = ls_column-r_column.
        lr_header = lr_column->get_header( ).
        lr_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_title ).
        lr_header = lr_column->create_header( ).
        case ls_column-id.
          when 'CNT_LINEITEMS'.
            lr_column->r_header->set_text( 'Line Items' ).
          when 'VAL_OPEN'.
            lr_column->r_header->set_text( 'Open Amount' ).
          when others.
        endcase.
    endloop

  • Problem in setting the task outcome programmatically

    Hi,
    I am trying to set the outcome of a human task programatically using the BPM API.I am using the following piece of code to achieve this:-
    taskService = wfServiceClient.getTaskService();
    task=taskService.updateTaskOutcome(wfContext, task.getSystemAttributes().getTaskId(), "SUBMIT");
    But what is happening is although the task form is being submitted and I can only see it in the completed list of tasks in the BPM workspace, the process flow is getting stuck at the human task node.Do I have to call anyother method in order to move the process flow to the next activity? I tried with :-
    taskService.submitInfoForTask(wfContext, task);
    But I am getting an exception.Any help is highly appreciated.
    Thanks
    Edited by: user11930797 on Nov 17, 2011 3:48 AM

    If the Human Task shows status complete, then it's possible that there was an error in the output data association in the process. In EM do you see a fault on the output for the Human Task activity, or if PS4FP the process will go to suspended state if the data association fails.

  • Problems in setting the Secondary y-axis caliberation

    Hi,
    I have a Business Graphics (Time-Scatter Graph) Application having 2 y-axis representing the sales volume. I have set the minimum value of the primary y-axis to 0 using the <b>default series</b>, but am unable to set the minimum value of the secondary y-axis value to 25. please help me in doing the same.
    Thanks

    Hi,
    have you set the minimum values using the chart designer? Just click on the second value axis node and set the minimum value to 25 (don't forget to set minimum calculation to user defined).
    Regards, Kai

  • MX922 scanner problem message: set the pc to start scanning

    I am trying to scan using my MX922 printer.  I am getting a message: "set the pc to start scanning." Can't find what this means.

    I ran into this... Suddenly the scan function from the Canon didn't work, I just got "Set the pc to start scanning."  WT??? Why work all this time and suddenly not?  Under scan>save/forward>select pc, only "local (usb)" appeared. No pc.  Yet the wireless connectivity was there (I checked, under WLAN set up).  Plus, I could print wirelessly, and could scan wirelessly if I initiated the scan from the computer via Canon utilities.  So it suddenly no longer could find the pc to scan from the unit, even though clearly the wireless connection was there.  Turned it on and off several times as suggested by another post.  Finally I went to Canon Utilities,> IJ Network Scanner Selector EX > Scan from Operation Panel Settings (button was already selected) > MX920 series already had box checked, so just said ok.  i.e. I didn't change a thing, but somehow that got it to work again, and I can now go back to scanning via the unit itself, specifically Scan button > Start on the MX922, instead of having to initiate the scan from the computer.  Hope this makes sense!

  • Problem to set the path of browser button in a textbox in JSF

    Hai guys I have a page which has a textbox and a command button. When I click the command button, a save dialogue box opens through which I can navigate to only DIRECTORIES and save my content. Therefore in the backend bean I have used a JFileChooser to invoke, I get the folder path, now my problem is to place this path into the textbox. How can I do that?
    I have used the fileUpload tag but in this it select only the files but not the folder? Can anyone suggest me the solution?

    AsishAnandAsha wrote:
    Hai guys I have a page which has a textbox and a command button. When I click the command button, a save dialogue box opens through which I can navigate to only DIRECTORIES and save my content. Not possible with HTML and thus also not with JSF.
    Therefore in the backend bean I have used a JFileChooser to invoke, I get the folder path, now my problem is to place this path into the textbox. How can I do that? Java runs at the server side, so also Swing components. The client will only see the JFileChooser if it runs at the same machine as where the server runs. Which wouldn't occur in real world.
    I have used the fileUpload tag but in this it select only the files but not the folder? Can anyone suggest me the solution?This is not possible with HTML or any other client side code. As JSF just wraps and renders HTML, it can also do nothing for you. Best what you can do is to write a signed applet or Web Start application which can select directories and send it to the server side.

  • Problem about set the size of an image

    Dear all,
    I encountered the following problem when programming with
    action script.
    I've got an image component. And I'd like to load the picture
    dynamically.
    So I called the function loadMovie like this:
    this.loadMovie( url );
    It seems work for me.
    But when I wanted to change the size of the image, the
    picture disappeared.
    I added the following line under the loadMovie function:
    this._width=500;
    this._height=500;
    Would anyone be kind enough to give any hintsto solve my
    problem?
    Any help would be appreciated and thanks in advance.

    resize the image file before it's loaded.
    Or you can call getScaledInstance on the Image object... which you can get from the ImageIcon, then construct a new ImageIcon with the scaled image.

  • Problem in setting the printer

    Hi,
    I am new to swings and am trying to print my table using PrintJob class. In this I will get the printer name. So I have to set that as a printer to do the job.
    I am able to print by selecting the printer in printDialog but I want to give my printer and I dont want that printDialog box. Plz tell me solution.
    As from the docs, i came to know that if we remove printdialog(), it wont show you the dialog box, but its talking the default one, my case is it should take the user input.
    Here is my code and working fine.
    public void print(String printer){
    // In this I have to set printer as the printer to do the job by suppresing the print dialog.
    PrinterJob pj = PrinterJob.getPrinterJob();
    PageFormat pf = pj.defaultPage();
    pj.setPrintable(this, pf);
    if (pj.printDialog()) {
    try {
         pj.print();
    } catch (Exception e) {
    Thanks in advance..
    Raj.

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.io.*;
    import java.util.*;
    import javax.print.*;
    import javax.swing.*;
    public class Print_Demo extends JFrame {
        public Print_Demo() {
            initComponents();
        private void initComponents() {
            toolBar = new JToolBar();
            printB = new JButton();
            printerField = new JTextField("Win32 Printer : HP DeskJet 610C");
            panel = new MyPanel();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setTitle("Print Demo");
            toolBar.setFloatable(false);
            printB.setText("Print");
            printB.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    printBActionPerformed(evt);
            toolBar.add(printB);
            toolBar.add(printerField);
            getContentPane().add(toolBar, BorderLayout.NORTH);
            getContentPane().add(panel, BorderLayout.CENTER);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-500)/2, (screenSize.height-500)/2, 500, 500);
        private void printBActionPerformed(ActionEvent evt) {
            PrinterJob pj=PrinterJob.getPrinterJob();
            pj.setPrintable((Printable)panel);
            PrintService[] services = pj.lookupPrintServices();
            boolean ok = false;
            for( int i=0; i < services.length; i++ ){
                System.out.println("Available PrintService: '"+services[i]+"'");
                if(services.toString().equalsIgnoreCase( printerField.getText() ) ){
    try{
    pj.setPrintService(services[i]);
    ok=true;
    }catch(PrinterException ex){
    System.out.println(ex.getMessage());
    if(ok){
    try{
    pj.print();
    }catch (PrinterException ex) {
    ex.printStackTrace();
    }else{
    JOptionPane.showMessageDialog(this,"Printer not available");
    public static void main(String args[]) {
    new Print_Demo().setVisible(true);
    private JButton printB;
    private JToolBar toolBar;
    private JPanel panel;
    private JTextField printerField;
    class MyPanel extends JPanel implements Printable{
    public void paint(Graphics g) {
    g.drawRect(100,100, 100,100);
    public int print(Graphics g, PageFormat pageFormat,
    int pageIndex) throws PrinterException {
    if(pageIndex>0) {
    return NO_SUCH_PAGE;
    paint(g);
    return Printable.PAGE_EXISTS;

  • Problem in setting the target directory in communication channel

    hi...
    my idoc 've been send successfully from the sender system and it also reached the receiver system. i conform it by checking the inbounds in IDX5.
    but it is not generating the xml file in the target directory.
    plz help me...

    Hi,
    Check the status of the receiver communication channel in RWB
    Configure Your Receiver File Channel as Following
    http://help.sap.com/saphelp_nw70/helpdata/EN/ae/d03341771b4c0de10000000a1550b0/frameset.htm
    File to File scenario:
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1 - File to File Part 1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2 - File to File Part 2
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/flatFILETOFLATFILE&
    Regards
    Seshagiri

  • Problem to set the custom layout as the default layout in std. transaction

    Hi all,
    I want to change the standard layout that is displayed in a standard transaction (EL31) as default. I want few more fields of the structure also to be displayed in the default layout of the standard transaction. I have made a custom layout that i want to be displayed but cant make that layout as the default layout for all users. Please suggest me some way to make the custom layout as the default layout for a standard transaction.

Maybe you are looking for

  • How can I disable files from being shown in spotlight?

    Hi All, In my spotlight preferences I've enabled only Applications, Folders, and System Preferences. However, in almost all of my searches, many individual files are shown. These are usualy .java, .jar, or .html even. To exacerbate the problem, spotl

  • Subject: Document attached to record (Automtically convert to PDF)

    Dear All, My requirement in record management is as follows: I have a document attached to a record. (Tcode: SCASE) The document needs to be converted into pdf and attached a different node in the record. All of this should be done by the system auto

  • XSLT Compile error at(649,16)

    I am using Xslt Call Template in several scripting functoid. Now I am getting the above error : XSLT compile error at (649,16). See InnerException for details. The contents of 'choose' are invalid. I want to narrow down my search. Please help me out

  • Inbox mail not showing up.

    I just set up a iMac. Having a problem with mail. My iphone is not showing my mail that is in my inbox on the imac. All other mailboxes have the mail in it. I tested by sending a email to my iphone from the imac. It shows up. However, Mail sent from

  • Delta deleted by mistake

    Hi Friends, by mistake i have deleted a delta for sales document  header  in rsa7. Can any please help me how i can get that delta back and how my released job will gain the delta from r3. Thanks, Prasad