Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » MySQL JDBC URL
MySQL JDBC URL [message #665659] Fri, 15 April 2011 12:07 Go to next message
Pavel Zelenka is currently offline Pavel Zelenka
Messages: 61
Registered: July 2009
Member
Hi,

I need to set some parameters in persistence.xml JDBC URL. But if I pass more than 1 parameter I got exception.

This works fine:
<persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="eclipselink.jdbc.url" value="jdbc:mysql://192.168.1.14:3306/autodily_3?zeroDateTimeBehavior=convertToNull"/>
            <property name="eclipselink.jdbc.user" value="..."/>
            <property name="eclipselink.jdbc.password" value="..."/>
        </properties>

This doesn't
    <persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="eclipselink.jdbc.url" value="jdbc:mysql://192.168.1.14:3306/autodily_3?zeroDateTimeBehavior=convertToNull&characterEncoding=Cp1252&useUnicode=false"/>
            <property name="eclipselink.jdbc.user" value="..."/>
            <property name="eclipselink.jdbc.password" value="..."/>
        </properties>

What's the right format for URL parameters?

Thanks

[Updated on: Fri, 15 April 2011 12:11]

Report message to a moderator

Re: MySQL JDBC URL [message #665669 is a reply to message #665659] Fri, 15 April 2011 12:43 Go to previous message
Pavel Zelenka is currently offline Pavel Zelenka
Messages: 61
Registered: July 2009
Member
I already found the reason. Since the character & is reserved character for XML documents it is necessary to use &amp; as the parameter separator.
Previous Topic:Change database schema at runtime
Next Topic:JPA problem: wrong sql in first execution
Goto Forum:
  


Current Time: Wed Oct 01 18:20:23 GMT 2014

Powered by FUDForum. Page generated in 0.02660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software