Reputation: 497
According to Mysql documentation, this connection string from xml configuration file is correct:
<property name="hibernate.connection.url">jdbc:mysql:///database?useSSL=false&allowPublicKeyRetrieval=true</property>
And Mysql Connector/J parses the query parameters correctly.
However same connection string fails to be parsed correctly when Hibernate configures StandardServiceRegistryBuilder as the parser expects that that "&" is a start of an entity name. I found another suggestion to replace "&" with "&" but this doesn't work either.
So what is the correct way of providing more than 1 parameter in hibernate xml configuration file? I'm using Mysql 8, Connector 8.0.13, Java 11 and Hibernate 5.3.7.
Upvotes: 3
Views: 1216
Reputation: 229
I had the same problem and it worked to me using &
to concatenate parameters:
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://localhost/pbdatabase?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true" />
Upvotes: 4
Reputation: 28
Would you try below?
<property name="hibernate.connection.url" value="jdbc:mysql:///database?useSSL=false&allowPublicKeyRetrieval=true" />
Upvotes: 0