Connection issues
I can’t connect to MySQL Database on Azure after I create a database. What should I do?
Here are solutions to some common causes:
- Confirm that you have added your current IP address to the safe list. You can complete this process in the Azure portal by selecting Configure and then adding the current IP.
- Confirm that the user name you’ve entered on the client side is in the instance name%username format. If you have checked both of the preceding points above but still can’t connect to the database, contact 21Vianet for technical support.
Why do timeouts frequently occur when I connect to the database?
The timeouts are caused by limitations in Azure Traffic Manager. You should manually set the server parameter in the Azure portal or in Windows PowerShell to any value from 60 to 240 seconds(120 is recommended). For instances created since October, you don’t need to set the server parameter manually. We have already adjusted the default value to 120 seconds with a selectable range of 60-240. (This change only works only on instances created since October.)
Do I have too few concurrent connections for MySQL Database on Azure?
To ensure that connections are used fully and effectively used, use connection pooling or persistent connections to connect to the database. For more information, see Connect efficiently to MySQL Database on Azure.
##Why is access to MySQL Database on Azure is sometimes fast and sometimes slow since I set up connection pooling?
This issue arises because the server configures a timeout mechanism, closing a connection that has been in an idle state for some time to free up resources. For this reason, you need to configure a verification system on the client to better maintain connection pooling and ensure access speeds for MySQL databases. This system is used to verify the effectiveness of connections and ensure that the allocated connections are all effective. For example, for more information on the Tomcat JDBC Connection Pool, see the JDBC connection pool official introduction document.
##How can I verify the effectiveness of persistent connections?
Let’s take the Tomcat JDBC connection pool as an example. By setting the TestOnBorrow parameter, when there’s a new request, the connection pool automatically verifies the effectiveness of any available connections that are idle before returning the idle connections. If such a connection is effective, it’s directly returned. If it’s not effective, the connection pool withdraws the connection. The connection pool then creates a new effective connection and returns it. This process ensures the speed of access to the database. For more information on configuration, see: Configure a verification mechanism to verify the effectiveness of a connection pool.
The JDBC connection to MySQL on Azure reports IllegalArgumentException. The error message is “URLDecoder: Illegal hex characters in escape (%) pattern - For input string: ...” Why do I get this error message?
This occurs because the percent sign (%) in the database user name was not correctly transferred to the connection string’s URL. Use the DriverManager.getConnection (URL, user name, password) function and type the user name and password into a transfer where the function automatically processes certain special characters. Alternatively, you can perform a manual transfer by replacing the "%" in the URL string with "%25".