title: [Ljava.lang.String;@7c5da1bepackage.name.user.categories.DAO
body: <p>I am trying to communicate with DAO class through getters/setters either providing or fetching data to DAO. I am beginner and here is what I did so far:</p>
  <pre><code>public class Bean {
  private String[] categories;
  
  public Bean(String[] categories) {
      super();
      this.categories = categories;
  }
  
  protected String[] getCategories() {
      return categories;
  }
  
  protected void setCategories(String[] categories) {
      this.categories = categories;
      System.out.print(categories);
  }
  }
  </code></pre>
  <p>Here is DAO code:</p>
  <pre><code>&gt; // INSERT
      protected boolean insert(Bean b) throws SQLException {
          int[] result = null;
          String[] categories = b.getCategories();
          
          try {
              cnn = getConnection();
              ps = cnn.prepareStatement(INSERT);
              for (int i = 0; i &lt; categories.length; i++) {
                  System.out.print(categories[i]);
                  if (categories[i] != null ) {
                      ps.clearParameters();
                      ps.setArray(1, cnn.createArrayOf(&quot;VARCHAR&quot;, categories));
                      ps.addBatch();
                  }
                  result = ps.executeBatch();
              }
              ps.clearBatch();
              cnn.commit();
              
  </code></pre>
  <p>I am getting parameter values in servlet get method as:</p>
  <pre><code>String[] categories = request.getParameterValues(&quot;category&quot;);
  </code></pre>
  <p>In controller servlet I am writing code like this:</p>
  <pre><code>Bean b = new Bean(categories);
      b.setCategories(categories);
      DAO db = new DAO();
      try {
          boolean inserted = db.insert(b);
          if(inserted) {
              out.print(inserted);
          }
          else {
              out.print(inserted);
          }
      } catch (SQLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  <p>The above code is throwing the following error:</p>
  <blockquote>
  <p>[Ljava.lang.String;@7c5da1becom.hello.user.categories.DAO</p>
  <p>java.lang.NullPointerException: Cannot invoke
  &quot;com.hello.commons.DBController.getJdbcDriver()&quot; because &quot;dbc&quot; is null
  Feb 11, 2021 10:02:31 AM org.apache.catalina.core.StandardWrapperValve
  invoke</p>
  </blockquote>
  <p>I am sure there are many mistakes. Being a beginner and learner please correct my code and advise best standards</p>
  <p>Best regards</p>