Current location: Hot Scripts Forums » Programming Languages » Everything Java » Regarding SQL exception


Regarding SQL exception

Reply
  #1 (permalink)  
Old 05-14-07, 05:19 AM
utd utd is offline
Newbie Coder
 
Join Date: Sep 2006
Location: richardson,texas
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Regarding SQL exception

When I'm trying 2 compile it i'm getting SQL exception stating that ResultSet is closed



java Code:
  1. import java.awt.*;
  2. import javax.swing.*;
  3. import java.sql.*;
  4. import java.io.*;
  5. import java.util.*;
  6. import javax.swing.JScrollPane;
  7. import java.awt.event.*;
  8. import java.lang.*;
  9.  
  10.  
  11. public class DataPrep extends JFrame
  12. {
  13.     //Jlist to shows fields names from datasets.
  14.     JList available_cols;
  15.     JList userselected_cols;
  16.    
  17.     //button to save,copy desired fields, submit and exit
  18.     JButton save;
  19.     JButton copy_button;
  20.     JButton submit_button;
  21.     JButton exit_button;
  22.    
  23.    
  24.     JLabel  title;
  25.     JLabel  heading;
  26.     JLabel  filenamelabel;
  27.    
  28.     //textfield to enter file name
  29.     JTextField filename;
  30.    
  31.     int numberOfColumns;
  32.     int userlistsize;
  33.     String[] column_names;
  34.     String[] usercol_names;
  35.     Vector v=new Vector();
  36.     String selectedlist="";
  37.    
  38.     String outfilename;
  39.     File savefile;
  40.     //file chooser to provide save option.
  41.     JFileChooser jfc=new JFileChooser();
  42.    
  43.     Double tempdata[][];
  44.     Double data[][];
  45.     Double[][] normalizeddata;
  46.    
  47.     //connection var to connect to excel sheet
  48.     Connection con=null;
  49.    
  50. //Begin of Constructor
  51.     public DataPrep()
  52.     {
  53.         super("DataPreprocessing");
  54.         getContentPane().setLayout(new BorderLayout());
  55.        
  56.         //Create panel to add title
  57.         JPanel titlepanel=new JPanel();
  58.         titlepanel.setLayout(new BorderLayout(10,15));
  59.                
  60.         //Create panel to add jlist component.
  61.         JPanel jlistpanel=new JPanel();
  62.         //Setting layout to boxlayout.
  63.         jlistpanel.setLayout(new BoxLayout(jlistpanel,BoxLayout.LINE_AXIS));
  64.     jlistpanel.setBorder(BorderFactory.createEmptyBorder(10,60,60,60));
  65.         jlistpanel.add(Box.createRigidArea(new Dimension(0,5)));
  66.        
  67.         //Create panel to add sumit and exit button
  68.         JPanel buttonpanel=new JPanel();
  69.         buttonpanel.setLayout(new BoxLayout(buttonpanel,BoxLayout.LINE_AXIS));
  70. buttonpanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 40, 90));
  71.         buttonpanel.add(Box.createHorizontalGlue());
  72.         buttonpanel.add(Box.createRigidArea(new Dimension(10, 0)));
  73.        
  74.        
  75.         heading=new JLabel("Data Preprocessing");
  76.         heading.setFont(new Font("Arial",Font.ITALIC,30));
  77.         heading.setHorizontalAlignment(JLabel.CENTER);
  78.         titlepanel.add(heading,BorderLayout.NORTH);
  79.        
  80.         //Creat panel to add save buttona and textfield
  81.         JPanel filepane=new JPanel();
  82.         filepane.setLayout(new FlowLayout());
  83.         filenamelabel=new JLabel("Click the Button to Save Your Normalized Data File(eg.output.txt):");
  84.         filename=new JTextField(20);
  85.         filename.setEditable(false);
  86.         save=new JButton("Save");
  87.         save.addActionListener(new savefile());
  88.         filepane.add(filenamelabel);
  89.         filepane.add(save);
  90.         filepane.add(filename)
  91.         titlepanel.add(filepane,BorderLayout.WEST);
  92.        
  93. title=new JLabel("Select the Interger Type Attributes From the List Below:");
  94.         titlepanel.add(title,BorderLayout.SOUTH);
  95.            
  96.         //Calling method in which coloumn names are read.
  97.         readcolnames();
  98.        
  99.        
  100.         available_cols=new JList(v);
  101.         available_cols.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  102.    
  103.         //Create a scrollpane to which jlist panel is added.
  104.         JScrollPane spane=new JScrollPane(available_cols);
  105.         jlistpanel.add(spane);
  106.        
  107.                
  108.                 copy_button=new JButton("Copy>>>");
  109.                
  110.                 //adding actionlistener to copy button
  111.                 copy_button.addActionListener
  112.                 (
  113.                     new ActionListener()
  114.                     {
  115.             public void actionPerformed(ActionEvent evt)
  116.                         {
  117.                                     userselected_cols.setListData(available_cols.getSelectedValues());
  118.                         }
  119.                     }
  120.            
  121.                 );
  122.                 jlistpanel.add(copy_button);
  123.        
  124.        
  125.         userselected_cols=new JList();
  126.         userselected_cols.setFixedCellWidth(100);
  127.         userselected_cols.setFixedCellHeight(15);
  128.         JScrollPane spane2=new JScrollPane(userselected_cols);
  129.         jlistpanel.add(spane2);
  130.         jlistpanel.setSize(50,20);
  131.         submit_button=new JButton("Fuzzify");
  132.                 //adding actionlisterner to submit button
  133.                 submit_button.addActionListener
  134.                 (
  135.                     new ActionListener()
  136.                     {
  137.             public void actionPerformed(ActionEvent evt)
  138.                         {
  139.                                         userlistsize=userselected_cols.getModel().getSize();
  140.                                
  141.                             usercol_names=new String[userlistsize+1];
  142.                            
  143.                             System.out.println("\nNo of attributs user selected is:"+userlistsize);
  144.                             System.out.println("\nUser selected Col names are:");
  145.                                         for(int i=1;i<(userlistsize+1);i++)
  146.                             {
  147.                                 //get the user selected names to string array
  148. usercol_names[i]=userselected_cols.getModel().getElementAt(i-1).toString();
  149.                                 System.out.println(usercol_names[i]);
  150.                                     if(i==userlistsize)
  151.                                 selectedlist=selectedlist+usercol_names[i];
  152.                                 else
  153.                                 selectedlist=selectedlist+usercol_names[i]+",";
  154.                             }
  155.                            
  156.                             System.out.println("The selected string is:: "+selectedlist);
  157.                            
  158.                             
  159.                    if(outfilename==null)
  160.                            {
  161.                              JOptionPane.showMessageDialog(null,"File is not created.ERROR","alert",JOptionPane.ERROR_MESSAGE);
  162.                            }
  163.                            else
  164.                            {
  165.                           
  166.                             readselectedcol(outfilename);
  167.                                JOptionPane.showMessageDialog(null,"File with Processed data is  created Successfully","alert",JOptionPane.INFORMATION_MESSAGE);
  168.                             }
  169.                         }
  170.                     }   
  171.                 );
  172.                 buttonpanel.add(submit_button);
  173.                
  174.                 //adding actionlistener to exit button
  175.                 exit_button=new JButton("Exit");
  176.                 exit_button.addActionListener
  177.                 (
  178.                         new ActionListener()
  179.                         {            public void actionPerformed(ActionEvent evt)
  180.                             {
  181.                                 //dispose the frame when user clicks exit button
  182.                                 dispose();
  183.                             }
  184.                         }   
  185.                 );
  186.                
  187.                 buttonpanel.add(exit_button);
  188.        
  189.         getContentPane().add(titlepanel,BorderLayout.PAGE_START);
  190. //    getContentPane().add(labelpanel,BorderLayout.NORTH);
  191.         getContentPane().add(jlistpanel,BorderLayout.CENTER);
  192.         getContentPane().add(buttonpanel,BorderLayout.PAGE_END);
  193.        
  194.  
  195.                
  196.        
  197.     }
  198.    
  199. //end of constructor
  200.  
  201.     //Implementing actionlistener for save button
  202.     private class savefile implements ActionListener
  203.     {
  204.         public void actionPerformed(ActionEvent evt)
  205.         {
  206.            
  207.             int val=jfc.showSaveDialog(DataPrep.this);
  208.            
  209.             if(val==JFileChooser.APPROVE_OPTION)
  210.             {
  211.             //get the file name from the jfilechooser component
  212.             savefile=jfc.getSelectedFile();
  213.         System.out.println("Saved file name is:"+savefile.getName());
  214.             outfilename=savefile.getName();
  215.             //set text field with file name
  216.             filename.setText(savefile.getName());
  217.             }
  218.        
  219.         }
  220.     }
  221.    
  222.     void readcolnames()
  223.     {
  224.        
  225.         try
  226.         {
  227.             //loading jbdc.odbc drivers
  228.             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  229.             //connection establishment
  230.     Connection con=DriverManager.getConnection("jdbc:odbc:clust");
  231.            
  232.             //Creating statement to execute query
  233.             Statement st=con.createStatement();
  234.             //execute query and get values to result set
  235.         ResultSet rs=st.executeQuery("Select * From [Sheet1$]");
  236.            
  237.             ResultSetMetaData rsmd=rs.getMetaData();
  238.             //get the column count
  239.             numberOfColumns=rsmd.getColumnCount();
  240.            
  241. System.out.println("No of columns in excel sheet are:"+numberOfColumns);
  242.            
  243.             System.out.print("Column Names are:");
  244.             column_names=new String[numberOfColumns+1];
  245.            
  246.                 for(int i=1;i<=numberOfColumns;i++)
  247.                 {
  248.             column_names[i]=rsmd.getColumnName(i);
  249.                                         v.add(column_names[i]);
  250.             System.out.print("\n"+column_names[i]);
  251.                 }
  252.            
  253.            
  254.            
  255.             st.close();
  256.             con.close();   
  257.            
  258.         }
  259.        
  260.         catch(Exception e)
  261.         {
  262.         System.err.print("Exception in selecting from xls: ");
  263.                 System.err.println(e.getMessage());
  264.            
  265.         }
  266.        
  267.        
  268.     }
  269.    
  270.     String selectedcolumn_names[];
  271.     int selectedcolumncount;
  272.        
  273.     void readselectedcol(String outputfile)
  274.     {
  275.    
  276.        
  277.         try{
  278.  
  279.         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  280.         Connection con = DriverManager.getConnection( "jdbc:odbc:clust" );
  281.         Statement st = con.createStatement();
  282.         Formatter fmt = new Formatter();
  283.         Formatter smt = new Formatter();
  284.         Formatter tmt = new Formatter();
  285.         int noofrows=0;
  286.         ResultSet rs = st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
  287.        
  288.         ResultSet newrs=st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
  289.         ResultSetMetaData rsmd = newrs.getMetaData();
  290.         selectedcolumncount=rsmd.getColumnCount();
  291.         selectedcolumn_names=new String[selectedcolumncount+1];
  292.        
  293.         for(int i=1;i<=selectedcolumncount;i++)
  294.                 {
  295. selectedcolumn_names[i]=rsmd.getColumnName(i);
  296.             v.add(column_names[i]);
  297.             System.out.print("\n"+selectedcolumn_names[i]);
  298.                 }
  299.                
  300.         while(rs.next())
  301.         {
  302.             noofrows++;
  303.         }
  304.         System.out.println("No-of-Rows "+noofrows);
  305.                
  306.         numberOfColumns = rsmd.getColumnCount();
  307.         tempdata=new Double[numberOfColumns+1][noofrows+1];
  308.         System.out.println(rsmd.getColumnCount());
  309.         double Data[][]=new double[noofrows+1][numberOfColumns+1];
  310.         double output[][]=new double[noofrows+1][(numberOfColumns*3)+1];
  311.  
  312.         int temp11=1;
  313.        
  314.             while(newrs.next())
  315.             {
  316.                 for(int j=1;j<=numberOfColumns;j++)
  317.                 {
  318.                     try
  319.                     {
  320.              Data[temp11][j]=Double.parseDouble(newrs.getString(j));
  321.                     System.out.print(Data[temp11][j]+" ");
  322.                     }
  323.                     catch(Exception ex)
  324.                     {
  325.                     System.err.print("Exception: ");
  326.                     System.err.println(ex.getMessage());
  327.                     }
  328.                 }
  329.                     System.out.println();
  330.                     temp11++;
  331.             }   
  332.      
  333.           File normalized_file=new File(outputfile);
  334.             FileWriter norm_fw=new FileWriter(normalized_file);
  335.          
  336.         data=new Double[noofrows+1][(numberOfColumns*3)+1];
  337.            
  338.             for(int k=1;k<=noofrows;k++)
  339.             {
  340.                 try
  341.                 {
  342.                
  343.                 for(int l=1;l<=numberOfColumns*3;l++)
  344.                 {
  345.                     fmt = new Formatter();
  346.                     data[k][l]=Data[l][k];
  347.     System.out.printf(fmt.format("%.2f",output[k][l]).toString()+"  ");
  348.                 }
  349.             //  System.out.println();
  350.                 }
  351.            
  352.                catch(Exception eg)
  353.                {
  354.             System.out.println("Exception internally   "+eg);
  355.                }
  356.             }
  357.            
  358.                
  359.         for(int i=1;i<=noofrows;i++)
  360.         {
  361.             for(int j=1;j<=numberOfColumns;j++)
  362.                     {
  363.                     //System.out.print(Data[i][j]+" "); 
  364.                     }
  365.                     //System.out.println();
  366.         }
  367.         int mmm=3;
  368.       for(int col=1;col<=numberOfColumns;col++)
  369.        {
  370.         try
  371.         {
  372.          
  373.         
  374.         double x1[] =new double[Data.length+1];
  375.         double x2[] =new double[Data.length+1];
  376.         System.out.println("x1 length   "+x1.length);
  377.        
  378.         for(int n=1; n<=noofrows; n++)
  379.                 {
  380.                     x1[n]=Data[n][col];
  381.                  //   System.out.print(x1[n]+"   ");
  382.                     
  383.                 }
  384.       
  385.                   double max=0;
  386.                   
  387.                   for(int n=1;n<=noofrows;n++)
  388.                   {
  389.                   
  390.                   if(x1[n]>max)
  391.                   {
  392.                       max = x1[n];
  393.                
  394.                     }
  395.                 }
  396.                               double min = x1[1];
  397.                   
  398.                   for(int n=1;n<=noofrows;n++){
  399.                   if(x1[n]<min){
  400.                   min = x1[n];
  401.                
  402.                 }
  403.                 }              double range=0;
  404.                   range=(max-min)/3;
  405.                                double a1=min + range;
  406.                   double a2=(a1) + range;
  407.                   double a3=(a2) + range;
  408.                   double m=0,m1=0;
  409.                  double c=0,c1=0;                                  double y[]= new double[x1.length];
  410.                  double y1[]= new double[x1.length];
  411.                  double y2[]= new double[x1.length];
  412.                         
  413.                  double x3=((a1-0.2)+(a2+0.2))/2;
  414.                 
  415.         //     System.out.println("x3 value is  " + x3);
  416.                   
  417.                   for(int k=1;k<=noofrows;k++)
  418.                  {
  419.                  
  420.                   x2[k]=(x1[k]);
  421.                  }          
  422.                   //int mmm=1;
  423.                   for(int z=1;z<=noofrows;z++)
  424.                   {
  425.                     if((x2[z]>=min)&&(x2[z]<(a1-0.2)))
  426.                     {
  427.                     
  428.                       m=(1/(min-a1));
  429.                   //  System.out.println("m value is " + m);
  430.                       
  431.                       c=-(m*(a1));
  432.                 //  System.out.println("C value is " + c);
  433.                     
  434.                       y[z]= m*(x2[z]) + c;
  435.                       y1[z]=0;
  436.                       y2[z]=0;
  437.                       fmt = new Formatter();
  438.                       smt = new Formatter();
  439.                       tmt = new Formatter();
  440.                                    
  441.                     }
  442.                                           
  443.                     if((x2[z]>a1)&& (x2[z]<=x3))
  444.                      {
  445.                         
  446.                         m=1/(x3-(a1-0.2));
  447.                         c=-(m*(a1-0.2));
  448.                         
  449.                         y1[z]=c+m*(x2[z]);
  450.                         y[z]=0;
  451.                         y2[z]=0;
  452.                         
  453.                         fmt = new Formatter();
  454.                         smt = new Formatter();
  455.                         tmt = new Formatter();
  456.                     
  457.                      }
  458.                                     
  459.                     if((x2[z]>=(a1-0.2)) && (x2[z]<=a1))
  460.                      {
  461.                         m=(1/(min-a1));
  462.                         c=-(m*(a1));
  463.                         y[z]= m*(x2[z]) + c;
  464.                         
  465.                         m1=1/(x3-(a1-0.2));
  466.                         
  467.                         c1=-(m1*(a1-0.2));
  468.                         y1[z]=c1+(m1*(x2[z]));
  469.                         
  470.                         y2[z]=0;
  471.                         fmt = new Formatter();
  472.                         smt = new Formatter();
  473.                         tmt = new Formatter();
  474.                     
  475.                      }
  476.                     
  477.                       if((x2[z]> x3)&& (x2[z]<a2))
  478.                      {
  479.                         m=1/(x3-(a2+0.2));
  480.                         c=-m*(a2+0.2);
  481.                         
  482.                         y[z]=0;
  483.                         y1[z]=m*(x2[z])+c;
  484.                         y2[z]=0;
  485.                         fmt = new Formatter();
  486.                         smt = new Formatter();
  487.                         tmt = new Formatter();
  488.                                          }     
  489.                         
  490.                      if(x2[z]>(a2+0.2) && (x2[z]<=a3))
  491.                      {
  492.                         m=1/(a3-a2);
  493.                         c=-m*(a2);
  494.                         
  495.                         y[z]=0;
  496.                         y1[z]=0;
  497.                         y2[z]=(m*(x2[z]))+c;
  498.                         fmt = new Formatter();
  499.                         smt = new Formatter();
  500.                         tmt = new Formatter();
  501.                     
  502.                      } 
  503.                         
  504.                      if ((x2[z]>=a2) && (x2[z]<=(a2+0.2)))
  505.                      {
  506.                         m=1/(x3-(a2+0.2));
  507.                         c=-m*(a2+0.2);
  508.                         
  509.                         m1=1/(a3-a2);
  510.                         c1=-m1*(a2);
  511.                         
  512.                         y[z]=0;
  513.                         y1[z]=m*(x2[z])+c;
  514.                         y2[z]=m1*(x2[z])+c1;
  515.                         fmt = new Formatter();
  516.                         smt = new Formatter();
  517.                         tmt = new Formatter();
  518.                                         
  519.                      }
  520.                      output[z][mmm-2]=y[z];
  521.                      output[z][mmm-1]=y1[z];
  522.                      output[z][mmm]=y2[z];
  523.                     
  524.                     // System.out.println(mmm);
  525.                   }//end of for in incrementing z
  526.       mmm=mmm+3;   
  527.          }
  528.          catch(Exception e1)
  529.          {
  530.          System.out.println("Exception in fuzzifying part "+e1);
  531.          }
  532.      
  533.       }///
  534.          //int dd=1;
  535.             //output formatting
  536.            
  537.             for(int k=1;k<=noofrows;k++)
  538.             {
  539.                 for(int l=1;l<=numberOfColumns*3;l++)
  540.                 {
  541.                     if((l%3)>0)
  542.                     {
  543.                     fmt = new Formatter();
  544.                     norm_fw.write(fmt.format("%.2f",output[k][l]).toString());
  545.                     norm_fw.write(" ");
  546.                     }
  547.                     else
  548.                     {
  549.                     fmt = new Formatter();
  550.                     norm_fw.write(fmt.format("%.2f",output[k][l]).toString());
  551.                     norm_fw.write("  ");
  552.                     }
  553.                 }
  554.             //  System.out.println();
  555.                
  556.             //  norm_fw.newLine();
  557.                 //System.out.println();
  558.                 }
  559.     
  560.      
  561.       st.close();
  562.     con.close();
  563.     norm_fw.close();
  564.         
  565.             }///end of try
  566.             catch(Exception e)
  567.             {
  568.               System.out.println("Exception in logic:   "+e);
  569.             }
  570.            
  571.     }
  572.    
  573. }

Last edited by Nico; 05-14-07 at 05:22 AM.
Reply With Quote
  #2 (permalink)  
Old 05-14-07, 05:31 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
could you please post which ResultSet is throwing that exception. There are 3 of them:
Java Code:
  1. ResultSet rs=st.executeQuery("Select * From [Sheet1$]");
  2. ResultSet rs = st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
  3. ResultSet newrs=st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 05-14-07, 05:42 AM
utd utd is offline
Newbie Coder
 
Join Date: Sep 2006
Location: richardson,texas
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
could you please post which ResultSet is throwing that exception. There are 3 of them:
Java Code:
  1. ResultSet rs=st.executeQuery("Select * From [Sheet1$]");
  2. ResultSet rs = st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
  3. ResultSet newrs=st.executeQuery("Select "+selectedlist+" From [Sheet1$]");
1stly thnx for ur reply


newrs is throwing that exception
Reply With Quote
  #4 (permalink)  
Old 05-14-07, 05:50 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
could you specify where the excepion is thrown (it should be in the exception-output)? You may just post the entire error-output, and then tell us which what is on the reported line

cheers
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #5 (permalink)  
Old 05-14-07, 05:58 AM
utd utd is offline
Newbie Coder
 
Join Date: Sep 2006
Location: richardson,texas
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
could you specify where the excepion is thrown (it should be in the exception-output)? You may just post the entire error-output, and then tell us which what is on the reported line

cheers

This is the Exception that I'm getting

Exception in logic: java.sql.SQLException: ResultSet is closed

This is my main() class

Here i'm giving the syntax for that main()

Java Code:
  1. import javax.swing.*;
  2.  
  3.  
  4. public class DataMining
  5. {
  6.     public static void main(String arg[])
  7.     {
  8.         MainMenu test=new MainMenu();
  9.        
  10.         test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11.         test.setSize(1290,790);
  12.         test.setVisible(true);
  13.     }
  14. }

Last edited by UnrealEd; 05-14-07 at 06:10 AM. Reason: please use the [highlight=Java] wrapper when posting java code
Reply With Quote
  #6 (permalink)  
Old 05-14-07, 06:12 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
but what is the entire error you're getting? it should be something like this:
Quote:
java.text.ParseException: Unparseable date: "2007-14-05"
at java.text.DateFormat.parse(Unknown Source)
at com.upjlib.audio.tags.id3.frames.ID3DateFrame.main (ID3DateFrame.java:25)
but then it should say something about an SQLException, and the line the exception occured (here this is line 25 in the ID3DateFrame class). Just post the entire error

The following methods can all throw that SQLException, so it can be any of these methods:
Java Code:
  1. ResultSetMetaData rsmd = newrs.getMetaData();
  2. ResultSetMetaData rsmd=rs.getMetaData();
  3. selectedcolumncount=rsmd.getColumnCount();
  4. selectedcolumn_names[i]=rsmd.getColumnName(i);
  5. numberOfColumns = rsmd.getColumnCount();
  6. Data[temp11][j]=Double.parseDouble(newrs.getString(j));
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks


Last edited by UnrealEd; 05-14-07 at 06:17 AM.
Reply With Quote
  #7 (permalink)  
Old 05-14-07, 06:17 AM
utd utd is offline
Newbie Coder
 
Join Date: Sep 2006
Location: richardson,texas
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
but what is the entire error you're getting? it should be something like this:

but then it should say something about an SQLException, and the line the exception occured (here this is line 25 in the ID3DateFrame class)
As such i didnt use any date object r something of that sort...y wud i be given wid that error...

Before excuting this project 1 got 2 select the work book..i guess u might be aware of all those jdbc connectivity...

It is executing till some part but raising the Exception at that part

Part of d execution followed by the exception is given below


No of columns in excel sheet are:4
Column Names are:
SL
SW
PL
PWSaved file name isutput.txt

No of attributs user selected is:1

User selected Col names are:
SW
The selected string is:: SW

SWException in logic: java.sql.SQLException: ResultSet is closed

Process completed.
Reply With Quote
  #8 (permalink)  
Old 05-14-07, 06:23 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
i just the error i posted as an example, it had nothing to do with your code. I just forgot you used e.getMessage() to get the exception-message, and not e.printStackTrace().

Replace this:
Java Code:
  1. System.out.println("Exception in logic:   "+e);
with this:
Java Code:
  1. System.out.println("Exception in logic:   ");
  2. e.printStackTrace();
this will output a stacktrace of the exception, and display the codeline where the exception was thrown from. Just post the output of that exception, and i'll check what method is throwing the error
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #9 (permalink)  
Old 05-14-07, 06:29 AM
utd utd is offline
Newbie Coder
 
Join Date: Sep 2006
Location: richardson,texas
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by UnrealEd View Post
i just the error i posted as an example, it had nothing to do with your code. I just forgot you used e.getMessage() to get the exception-message, and not e.printStackTrace().

Replace this:
Java Code:
  1. System.out.println("Exception in logic:   "+e);
with this:
Java Code:
  1. System.out.println("Exception in logic:   ");
  2. e.printStackTrace();
this will output a stacktrace of the exception, and display the codeline where the exception was thrown from. Just post the output of that exception, and i'll check what method is throwing the error
This is the Exception I'm getting

Exception in logic:
java.sql.SQLException: ResultSet is closed
at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(JdbcOdbc ResultSet.java:6647)
at sun.jdbc.odbc.JdbcOdbcResultSet.next(JdbcOdbcResul tSet.java:1248)
at DataPrep.readselectedcol(DataPrep.java:369)
at DataPrep$2.actionPerformed(DataPrep.java:207)
at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.jav a:5488)
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3126)
at java.awt.Component.processEvent(Component.java:525 3)
at java.awt.Container.processEvent(Container.java:196 6)
at java.awt.Component.dispatchEventImpl(Component.jav a:3955)
at java.awt.Container.dispatchEventImpl(Container.jav a:2024)
at java.awt.Component.dispatchEvent(Component.java:38 03)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3822)
at java.awt.Container.dispatchEventImpl(Container.jav a:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774 )
at java.awt.Component.dispatchEvent(Component.java:38 03)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 463)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:110)
Reply With Quote
  #10 (permalink)  
Old 05-14-07, 07:19 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
did you make any changes to the class you posted in your first post? cause line 369 says:
Java Code:
  1. int mmm=3;
what does line 369 says in your class?
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: ResultSet not open, operation 'next' not permitted. Verify that autocommit is qirana Everything Java 2 04-14-07 04:06 AM
2 Months Free Hosting -Windows 2003 | Cold Fusion MX | SQL Server | ASP.NET Gineey General Advertisements 0 01-11-06 05:31 AM
Help with ASP & FORMS blessedrub ASP 0 01-23-04 10:22 AM
ASP Calendar..HELP...pls jimthepict ASP 1 07-31-03 05:01 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 05:42 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.