In reference to this question, I'm trying to frame the connection string to connect to MySQL database with the following connection parameters, but I'm unable to get it right.
I've referred the documentation that the post is referring to, but I'm unable to resolve even after following the instructions. Can anybody help me in this regard?
Connection Parameters that are being used:
useOldAliasMetadataBehavior=true
useUnicode=true
characterEncoding=UTF-8
Normal connection string: jdbc:mysql://localhost:3307/databaseName
Adding these connection parameters and their corresponding values, how would the connection string be?
By default 151 is the maximum permitted number of simultaneous client connections in MySQL 5.5. If you reach the limit of max_connections you will get the “Too many connections” error when you to try to connect to your MySQL server. This means all available connections are in use by other clients.
Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=;Database=myDataBase;User=myUsername;Password=myPassword; The driver defaults to port value 3306, if not specified in the connection string, as 3306 is the default port for MySQL.
Connect and Disconnect. Connections correspond to Sessions in SQL standard terminology. A client connects to the MySQL Server and stays connected until it does a disconnect.
According to the reference documentation, it would be:
jdbc:mysql://localhost:3307/databaseName?useOldAliasMetadataBehavior=true&unicode=true&characterEncoding=UTF-8
However, the standard port is 3306 not 3307 like in your question.
Just stitch parameters like a url, eg:
jdbc:MySql://localhost:3307/databaseName?characterEncoding=UTF-8&useUnicode=true&useOldAliasMetadataBehavior=true
If your connection string is being held in an XML or properties document, you need to encode &
as &
, like this:
jdbc:MySql://localhost:3307/databaseName?characterEncoding=UTF-8&useUnicode=true&useOldAliasMetadataBehavior=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With