title: Issue establishing a database connection with a char array instead of a String
body: <p>As the title says, I'm looking into finding a way to use a char[] array to establish a JDBC connection instead of creating a new String object from the char[] array and using that to establish the connection.</p>
  
  <p>Because char[] arrays are <a href="https://stackoverflow.com/questions/8881291/why-is-char-preferred-over-string-for-passwords">more secure than Strings in java</a>, I've been wanting to keep things as secure as possible when dealing with my JPasswordFields.</p>
  
  <p>In this particular case, I'm taking the char[] array contents of a JPasswordField and attempting to establish a JDBC connection to a database. It works perfectly well, but I'm having to create a new String object from the char[] array to actually call the <em>getConnection</em> method.</p>
  
  <p>Is there any way to ensure at-least some security doing this, or am I just forced to create the String object and continue on using that in the method?</p>
  
  <p>This is my code:</p>
  
  <pre><code>/**
   * Construct a new DataManager object with it's own
   * connection to the database.
   *
   * @param ipAddress The IP address to the server on which MySQL is running.
   * @param port The port to use when connecting to MySQL.
   * @param databaseName The database name of the database to connect to.
   * @param username The username for a MySQL account with access to the specified database.
   * @param password The password for the MySQL account specified by the specified username.
   */
  public DataManager(final String ipAddress, final String port, final String databaseName, final String username, final char[] password) throws ClassNotFoundException, IllegalAccessException, InstantiationException, SQLException {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      String url = "jdbc:mysql://" + ipAddress + ":" + port + "/" + databaseName + "?noAccessToProcedureBodies=true"; //?noAccessToProcedureBodies=true is required for using the stored procedures.
      dbConnection = DriverManager.getConnection(url, username, new String(password));
  }
  </code></pre>
  
  <p>Sorry for the formatting, but the lines are a bit long and they wrap.</p>
  
  <p><a href="https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManager.html">Here's the Java docs for the DriverManager class</a> that I'm using. I've checked and there doesn't seem to be a method to use the <code>char[]</code> instead of the <code>String</code> and that's what prompted this post.</p>
  
  <p>Thanks for any help/tips.</p>