Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

spring

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?

like image 905
Stefan Falk Avatar asked Jun 02 '16 15:06

Stefan Falk


1 Answers

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" />
like image 141
Jeremy Gosling Avatar answered Sep 18 '22 13:09

Jeremy Gosling