title: I query to get a column default value but ORA-17003 appears
body: <p>I need a method which returns a column default value, so I've made this method:</p>
  
  <pre><code>public String mostraDefault(String column) {
          String def = null; //default value
          try {
              //query to get the def value (tried on oracle and works)
              String sql = "Select DATA_DEFAULT from USER_TAB_COLUMNS where TABLE_NAME ='CLASSDIAGRAM' and COLUMN_NAME = '" + column.toUpperCase() + "'";
              conn = Database.nuovaConnessione();
              ps = conn.prepareStatement(sql);
              rs = ps.executeQuery();
              if (rs.next()) {
                  def = rs.getString(1);
              }
          } catch (SQLException ex) {
              //Logger.getLogger(ClassDiagram.class.getName()).log(Level.SEVERE, null, ex);
          }
          return def;
      }
  </code></pre>
  
  <p>This method is called by the following, which allows to insert recort into a table throughout a Java Swing GUI:</p>
  
  <pre><code>    public void insertRecord() {
          try {
              //query to insert
              String sql = "INSERT INTO ClassDiagram(Nome) VALUES(?)";
              conn = Database.nuovaConnessione();
              ps = conn.prepareStatement(sql);
              String nome;
              //handle default value
              if (txtNome.getText().isEmpty()) {
                  //nome = "Nuovo progetto";
                  nome = mostraDefault("nome");
                  System.out.println(nome); //this correctly prints its def val on stout
              } else {
                  nome = txtNome.getText();
              }
              ps.setString(1, nome);
              ps.executeUpdate();
          } catch (SQLException e) {
              //this gets thrown
              JOptionPane.showMessageDialog(this, e.getMessage(), "Errore SQL: " + e.getErrorCode(),
                      JOptionPane.ERROR_MESSAGE);
          } catch (Exception e) {
              JOptionPane.showMessageDialog(this, e.getMessage(), "Errore",
                      JOptionPane.ERROR_MESSAGE);
          } 
      }
  </code></pre>
  
  <p>But this method throws </p>
  
  <blockquote>
    <p>Errore SQL 17003: invalid column index</p>
  </blockquote>
  
  <p>(SQLException gets thrown)</p>
  
  <p>But I can't figure out what I'm missing.</p>
  
  <p>Edit: if I close rs and conn in a finally clause in <code>mostraDefault</code> method, </p>
  
  <blockquote>
    <p>Errore SQL 17009: closed statement
    gets thrown.</p>
  </blockquote>