Results 1 to 3 of 3
  1. #1
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default java.sql.SQLException: Missing IN or OUT parameter at index:: 1

    Need Suggestions on this --

    Java Code:
     Connection connection = null;
            PreparedStatement statement = null;
            try {
                connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:Oracle9i", "rms", "stephen00.rms");
    
                String str = "insert into rms_accountstore( invoice_type, customer_name, customer_address, tin_number) values(?, ?, ?, ?)";
                statement = connection.prepareStatement(str);
    
                if (jRadioButton1_flag) {
                    statement.setString(1, "sales");
                } else if (jRadioButton2_flag) {
                    statement.setString(1, "tax");
                }
                statement.setString(2, jTextField1.getText());
                statement.setString(3, jTextField2.getText());
                statement.setString(4, jTextField3.getText());
    
                statement.executeQuery();
    
            } catch (SQLException sqlException) {
                sqlException.printStackTrace();
            } finally {
                try {
                    statement.close();
                    connection.close();
                } catch (Exception exception) {
                    exception.printStackTrace();
                    System.exit(1);
                }
            }
    The exception is thrown... as stated in the topic of this thread.:cool:
    The Quieter you become the more you are able to hear !

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default

    Does this happen, by any chance, when both the radio button flags are false?
    Because in that situation you will not be setting the first parameter of your INSERT.

  3. #3
    Stephen Douglas's Avatar
    Stephen Douglas is offline Senior Member
    Join Date
    Mar 2010
    Posts
    137
    Rep Power
    0

    Default

    I got where i was wrong........... any ways thanx for your concerns. :)
    The Quieter you become the more you are able to hear !

Similar Threads

  1. java.sql.SQLException: Closed Connection
    By sunjavaboy in forum JDBC
    Replies: 4
    Last Post: 03-21-2012, 01:38 PM
  2. Replies: 6
    Last Post: 09-01-2010, 11:29 AM
  3. Replies: 2
    Last Post: 06-07-2010, 08:45 AM
  4. Unreported exception java.sql.SQLException
    By javamula in forum AWT / Swing
    Replies: 4
    Last Post: 09-29-2009, 02:32 PM
  5. java.sql.SQLException: ORA-01722: invalid number
    By balushanmukha in forum JDBC
    Replies: 0
    Last Post: 08-27-2008, 06:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •