Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 495127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:33:49+00:00 2026-05-13T05:33:49+00:00

I have a Manager class and also one frame which isReport .In the frame

  • 0

I have a “Manager” class and also one frame which is”Report” .In the frame I have three radio buttons which their texts are “Years before 1970″,”between 1970 and 2000″,”years after 2000″ and if one of them is selected , in the text field below these radio buttons I will show the number of rows that have this situation which are in my SQL table.also in my SQL table I have created a table that has name, family, fatherName,motherName,dateOfBirth,placeOfBirth,Also the first column is ID which is created automatically .the text in dateOfBirth column is like”December 5, 2009” and I need just its year !!! but when i run this code these stack trace will be shown in the console,why?? please help me.

my Manager class(just a part of that):

 public static int getPercent(String i)throws SQLException{
    Statement stmt = conn.createStatement();
    List<String> list = null;
    if(i.equals("O")){


        ResultSet rst =  stmt.executeQuery("SELECT dateOfBirth from birthtable");
        while(rst.next()){
           String s1 = rst.getString(6) ;
           if(rst.wasNull()){
               s1=null;
           }
           String s2 = s1.substring(s1.length()-4);
           int s3 = Integer.parseInt(s2);
           if(list ==null&& s3<1970){
               list = new ArrayList<String>();
           }
           else{
               list = new ArrayList<String>();
               s2 = null;
           }
           list.add(s2);
        }


    }
    if(i.equals("N")){

        ResultSet rst =  stmt.executeQuery("SELECT dateOfBirth from birthtable");
        while(rst.next()){
           String s1 = rst.getString(6) ;
           if(rst.wasNull()){
               s1=null;
           }
           String s2 = s1.substring(s1.length()-4);
           int s3 = Integer.parseInt(s2);
           if(list ==null&&s3>2000 ){
               list = new ArrayList<String>();
           }
           else{
               list  = new ArrayList<String>(0);
               s2 = null;
           }
           list.add(s2);
        }
    }
    if(i.equals("H")){
        ResultSet rst =  stmt.executeQuery("SELECT dateOfBirth from birthtable");
        while(rst.next()){
           String s1 = rst.getString(6) ;
           if(rst.wasNull()){
               s1=null;
           }
           String s2 = s1.substring(s1.length()-4);
           int s3 = Integer.parseInt(s2);
           if(list ==null&&s3>1970&& s3<2000 ){
               list = new ArrayList<String>();
           }
           else{
               list  = new ArrayList<String>(0);
               s2 = null;
           }
           list.add(s2);
        }
    }
    return list.size();
}

my frame(just a part of that):

 private void range1ActionPerformed(java.awt.event.ActionEvent evt) {
   int i = 0;
    try {
        i = Manager.getPercent("O");
    } catch (SQLException ex) {
        Logger.getLogger(BirthReport.class.getName()).log(Level.SEVERE, null, ex);
    }
   resulText.setText(i+"");
}

stacktarce:

      Dec 17, 2009 7:57:48 AM AdminGUI.BirthReport range1ActionPerformed
    SEVERE: null

java.sql.SQLException: Column Index out of range, 6 > 1. 
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
        at com.mysql.jdbc.ResultSetImpl.checkColumnBounds(ResultSetImpl.java:792)
        at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5529)
        at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448)
        at database.Manager.getPercent(Manager.java:1137)
        at AdminGUI.BirthReport.range1ActionPerformed(BirthReport.java:152)
        at AdminGUI.BirthReport.access$100(BirthReport.java:23)
        at AdminGUI.BirthReport$2.actionPerformed(BirthReport.java:84)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.Component.processMouseEvent(Component.java:6038)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
        at java.awt.Component.processEvent(Component.java:5803)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
        at java.awt.Container.dispatchEventImpl(Container.java:2102)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
        at java.awt.Dialog$1.run(Dialog.java:1039)
        at java.awt.Dialog$3.run(Dialog.java:1091)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:1089)
        at java.awt.Component.show(Component.java:1419)
        at java.awt.Component.setVisible(Component.java:1372)
        at java.awt.Window.setVisible(Window.java:801)
        at java.awt.Dialog.setVisible(Dialog.java:979)
        at AdminGUI.BirthFrame.jButton1ActionPerformed(BirthFrame.java:190)
        at AdminGUI.BirthFrame.access$300(BirthFrame.java:21)
        at AdminGUI.BirthFrame$4.actionPerformed(BirthFrame.java:94)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
        at java.awt.Component.processMouseEvent(Component.java:6038)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
        at java.awt.Component.processEvent(Component.java:5803)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
        at java.awt.Container.dispatchEventImpl(Container.java:2102)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:33:50+00:00Added an answer on May 13, 2026 at 5:33 am

    The answer is in the stack trace! Look at line 1137 where you call getString(6). Now look at the error message: java.sql.SQLException: Column Index out of range, 6 > 1. now look at your query: “SELECT dateOfBirth from birthtable”.

    You are asking (in the query) for 1 value (dateOfBirth) and they you are trying to get it as the 6th value returned… so change the 6 to a………. 1 and it should work.

    You really do need to read the messages – they tell you a lot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a manager class, which update json data from web, get values... The
I have a class that is a manager sort of class. One of it's
I have a Manager class that saves data in the SQL table and also
I have a manager class with a number of sub-classes. I find one particular
I have an sqlConnection manager class like so: public class SQLConn { public string
I have a class Manager and a class Base (with subclasses deriving from Base,
I have a simple update method in my manager class and I need to
I have the following manager<->worker situation: class Manager { private: pthread_attr_t workerSettings; pthread_t worker;
I have the following: MODEL.PY LIST = (('Manager', 'Manager'),('Non-Manager', 'Non-Manager'),) class Employee(models.Model): fname =
In my game I have a concept of resource manager, a class that stores

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.