Hi Maxim,

I went further with debug mode and I could check that the property was well 
taken into account, each time I change it I see it in the _schema object.
I was able to reproduce the issue with a PostgreSQL JDBC Driver v42.7.4 : the 
default value of schemaCase parameter is 'lower', when I set something 
different (preserve or upper) I got the exception from the jdbc driver. So I 
tried to set this value ('lower') with PostgreSQL JDBC Driver v42.7.5 but the 
exception appears. I continue to investigate to see where comes from exactly 
this issue since on PostgreSQL JDBC Driver v42.7.5 they did the following 
change : 
https://github.com/pgjdbc/pgjdbc/commit/7c49f620be9914c4e26a827f08939467af8e93e5#diff-0571f8ac3385a7f7bb34e5c77f8afd24810311506989379c2e85c6c16eea6ce4L1195-R1275

Fred

-----Message d'origin
De : Maxim Solodovnik <solomax...@gmail.com> 
Envoyé : mardi 19 août 2025 07:12
À : MONCLAR Frederic <frederic.monc...@thalesaleniaspace.com>
Cc : dev@openjpa.apache.org
Objet : Re: how to get database name case preserved in url of ConnectionURL 
property

Hello Fred,

sorry for the late responses (my free time is limited :(( ) I'll try to create 
reproducer for your case locally and will report back to this thread :)

On Mon, 18 Aug 2025 at 16:52, MONCLAR Frederic 
<frederic.monc...@thalesaleniaspace.com> wrote:
>
> Hi Maxim,
>
> I saw that openjpa v4.1.1 was not verified with PostgreSQL v17 and PostgreSQL 
> JDBC Driver v42.7.5 :
> (PostgreSQL     8.3.5, 8.4, 9, 11, 12, 13       / PostgreSQL Native Driver    
>   8.3 JDBC3 (build 603), 8.4 JDBC3 (build 701), 42.2.5, , 42.2.19)
> So do you think that it can explain why this property does not work in my 
> case ?
> Thanks
> Fred
>
> -----Message d'origine-----
> De : MONCLAR Frederic
> Envoyé : jeudi 14 août 2025 09:35
> À : 'Maxim Solodovnik' <solomax...@gmail.com> Cc : 
> dev@openjpa.apache.org Objet : RE: how to get database name case 
> preserved in url of ConnectionURL property Critère de diffusion : 
> Confidentiel
>
> Hi Maxim,
> Thank you for your reply.
> I attach the picture to my reply in order to make it visible. This image is a 
> capture of the code changes in PostgreSQL JDBC Driver v42.7.5 that create my 
> issue. It is annoying that the JDBC driver has evolved like that on a minor 
> version.
> I tried what you proposed : <property name="openjpa.jdbc.DBDictionary" 
> value="postgres(schemaCase=preserve)"/> but it does not work. I still 
> get the error where the lib try to create tables like if the table 
> does not exists :-( Fred
>
> 14-08-2025 09:32:10.317 [main] INFO  
> [d.t.e.APersistencedb][openPhaseRemote] 
> {openjpa.ConnectionURL=jdbc:postgresql://localhost:9999/DB_TEST, 
> openjpa.ConnectionUserName=postgres, 
> openjpa.ConnectionPassword=postgres}
> 14-08-2025 09:32:12.031 [main] ERROR 
> [d.t.e.APersistencedb][openPhaseRemote] ERREUR: la relation « 
> openjpa_sequence_table » existe déjà {stmnt 971404566 CREATE TABLE 
> OPENJPA_SEQUENCE_TABLE (ID SMALLINT NOT NULL, SEQUENCE_VALUE BIGINT, 
> PRIMARY KEY (ID))} [code=0, state=42P07]
> org.apache.openjpa.persistence.PersistenceException: ERREUR: la relation « 
> openjpa_sequence_table » existe déjà {stmnt 971404566 CREATE TABLE 
> OPENJPA_SEQUENCE_TABLE (ID SMALLINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY 
> KEY (ID))} [code=0, state=42P07]
>         at 
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:625)
>         at 
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:488)
>         at 
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:173)
>         at 
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(J
> DBCBrokerFactory.java:178)
>
> -----Message d'origine-----
> De : Maxim Solodovnik <solomax...@gmail.com> Envoyé : jeudi 14 août 
> 2025 06:46 À : MONCLAR Frederic 
> <frederic.monc...@thalesaleniaspace.com>
> Cc : dev@openjpa.apache.org
> Objet : Re: how to get database name case preserved in url of 
> ConnectionURL property
>
> re-sending with modified email of TS :)
>
> On Thu, 14 Aug 2025 at 11:44, Maxim Solodovnik <solomax...@gmail.com> wrote:
> >
> > Hello Fred,
> >
> > welcome to the list :)
> >
> >
> > On Wed, 13 Aug 2025 at 13:35, MONCLAR Frederic 
> > <frederic.monc...@thalesaleniaspace.com.invalid> wrote:
> > >
> > > Hello,
> > >
> > >
> > >
> > > I would like to know if there is an option in persistence.xml or in 
> > > creating entity manager factory methods where I can specify to use 
> > > “CASE_PRESERVE” in order to preserve the case of the name of the database 
> > > in ConnectionURL property?
> > >
> >
> > It seems to me this question better fits users@openjpa.a.o 
> > mailing-list :))
> >
> > >
> > >
> > > I recently posted an issue on PostgreSQL JDBC Driver v42.7.5/6/7 : 
> > > https://github.com/pgjdbc/pgjdbc/issues/3731 because I get the following 
> > > exception :
> > >
> > >
> >
> > I would try to set
> >
> > openjpa.jdbc.DBDictionary: postgres(schemaCase=preserve)
> >
> > like this:
> >
> > <properties>
> >     <property name="openjpa.jdbc.DBDictionary"
> > value="postgres(schemaCase=preserve)" /> </properties>
> >
> >
> > >
> > > 22-07-2025 13:05:52.082 [pool-6-thread-1] ERROR 
> > > [c.t.s.s.p.d.i.f.APersistencedb][openPhaseRemote] ERREUR: la 
> > > relation « element » existe déjà {stmnt 445531560 CREATE TABLE 
> > > element ...))} [code=0, state=42P07]
> > > org.apache.openjpa.persistence.PersistenceException: ERREUR: la 
> > > relation « element » existe déjà {stmnt 445531560 CREATE TABLE 
> > > element ...)} [code=0, state=42P07] at
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:6
> > > 25
> > > ) at
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:4
> > > 88
> > > )
> > >
> > >
> > >
> > > when I try to create an EntityManager and it was working fine until 
> > > version 42.7.4 :
> > >
> > >
> > >
> > >       String dbUrl = "jdbc:postgresql://" + 
> > > "localhost:9999/\"DB_TEST\"";
> > >
> > >       properties.put("openjpa.ConnectionURL", dbUrl);
> > >
> > >       properties.put("openjpa.ConnectionUserName", "postgres");
> > >
> > >       properties.put("openjpa.ConnectionPassword", "postgres");
> > >
> > >
> > >
> > >       EntityManagerFactory emf =
> > > Persistence.createEntityManagerFactory("test_db", properties);
> > >
> > >       EntityManager em = emf.createEntityManager();
> > >
> > >
> > >
> > > PostgreSQL JDBC Driver support explained that they did the following 
> > > change in v42.7.5 :
> > >
> > >
> > >
> > > https://github.com/apache/openjpa/blob/87e253b9e58a8f061b0431a1ab4
> > > df 
> > > 3e5e1660519/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ide
> > > nt
> > > ifier/DBIdentifierUtilImpl.java#L407-L431
> > >
> > >
> >
> > Unfortunately your image was not delivered to the list Please upload 
> > it to some image-sharing-service and send URL :))
> >
> > >
> > > and since, I can’t use uppercase for the name of the database- L
> > >
> > > They proposes to find a way in openjpa to preserve case for database name.
> > >
> > >
> > >
> > > Thanks for any help.
> > >
> > > Fred
> >
> >
> >
> > --
> > Best regards,
> > Maxim
>
>
>
> --
> Best regards,
> Maxim



--
Best regards,
Maxim

Reply via email to