title: JDBC for MySQL connection: works with MySQL Workbench, not with JDBC
body: <p>I have a database server running on a bluehost machine, and I am giving myself remote IP access (via my IP address).</p>
  
  <p>On my client machine, I have MySQL Workbench, and I have some Java code. MySQL workbench is getting the connection, using the database that I would like it to. With the driver manager connection, I cannot specify my database, such as with a forward slash after the port # in the URL, or it will give a connect error.</p>
  
  <p>I can get the connection with the same userid and password using Workbench or the driver manager, but with JDBC it doesn't want to give me access to the same database.</p>
  
  <p>When I try to execute this <code>(JDBC): "use database"</code>, I get:</p>
  
  <blockquote>
    <p>Access denied for user 'userid'@'184.11.22.%' to database 'database'</p>
  </blockquote>
  
  <p>The URL I am using is </p>
  
  <pre><code>jdbc:mysql://(server-ip):(port)
  </code></pre>
  
  <p>If I try to append a '/(database)' on to the URL it gives the access violation.  MySQL Workbench isn't getting any other special information, but appears to connect with the specified default schema.  Same client machine; same user id and password. What is going wrong with the JDBC connection? </p>
  
  <p>Java code added:</p>
  
  <pre><code>    db = DriverManager.getConnection(
          "jdbc:mysql://74.220.192.113/advanfc7_atm?" + 
          "user=(myuserid&amp;password=(mypwd)");
      System.out.println("Connected.");
    statement = db.createStatement();
    statement.execute("use advanfc7_atm");
  } catch (Exception e) {
    System.out.println("InitDB() "+e.getMessage());
  </code></pre>
  
  <p>}</p>
  
  <p>I've also done it with 3 parameters to getConnection(), separating userid and password to the 2nd and 3rd params. </p>