9

It's one of those days where nothing works as it should.

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://localhost:3306/mz_db?useSSL=false&useLegacyDatetimecode=false" />
    <property name="username" value="root" />
    <property name="password" value="" />
</bean>

The above giving me this error message:

The reference to entity "useLegacyDatetimecode" must end with the ';' delimiter.

But the thing is that it is wrong:

jdbc:mysql://[host1][:port1][,[host2][:port2]]...[/[database]] ยป
[?propertyName1=propertyValue1[&propertyName2=propertyValue2]...]

es explained here.

Caused by: org.xml.sax.SAXParseException; lineNumber: 32; columnNumber: 105; The reference to entity "useLegacyDatetimecode" must end with the ';' delimiter.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)

So what's this all about?

Sagar V
  • 12,158
  • 7
  • 41
  • 68
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378

2 Answers2

27

Similar to this. To embed an ampersand character in a url it needs to coded as &amp;

<property name="url" value="jdbc:mysql://localhost:3306/mz_db?useSSL=false&amp;useLegacyDatetimecode=false" />
Community
  • 1
  • 1
Jeremy Gosling
  • 1,130
  • 10
  • 11
0

It's just a minor error due to coding style.It worked for me for the latest version of Hibernate 5.4.12 .

<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/schema_name?verifyServerCertificate=false&useSSL;</property>