Thanks. That got me on the path to success
Rick Bonnett Programmer Analyst Ascent Global Logistics [X] PO Box 1039, Augusta, ME, 04332 Office: 207.620.8670 ascentgl.com<http://ascentgl.com/> [cid:eeb9a99a-9f1c-43c5-b220-54ed4a9e63ad] ________________________________ From: Michael Gentry <blackn...@gmail.com> Sent: Wednesday, June 9, 2021 12:26 PM To: Cayenne Users <user@cayenne.apache.org> Subject: Re: SSL connections to postgresql in Azure EXTERNAL EMAIL: Be extra careful around links and attachments. Hi Rick, Are you connecting: a) local development system -> Azure Postgres b) Azure server -> Azure Postgres? If "a", are there SSL certificates from Azure you need to load into your local Java environment. Or you could try turning off SSL verification. See more (for both options) here: https://jdbc.postgresql.org/documentation/head/ssl-client.html<https://jdbc.postgresql.org/documentation/head/ssl-client.html> Also, maybe try adding: .put("ssl", "true"); // Or some other combo from above link... On Wed, Jun 9, 2021 at 10:59 AM Rick Bonnett <richard.bonn...@ascentgl.com> wrote: > > Having issues connecting to postgres in Azure - because by default SSL > connections are required. I am using: > > - cayenne 3.1 - yes I know it's old but it's what I'm stuck with > - latest postgres JDBC driver > > Code snippets below. > > On the JDBC_URLPROPERTY I have tried every flavor of ssslmode=required or > usessl=true that I've been able to dredge up, but consistenyly getting: > > Unable to connect to server: FATAL: SSL connection is required. Please > specify SSL options and retry. > > Hopefully I am just overlooking something simple and obvious. Any insights? > > Module m1 = new Module() { > public void configure(Binder binder) { > binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.JDBC_DRIVER_PROPERTY, > "org.postgresql.Driver") > .put(Constants.JDBC_URL_PROPERTY, "jdbc:postgresql:// > http://mypostgres.postgres.database.azure.com:5432/are<http://mypostgres.postgres.database.azure.com:5432/are>") > .put(Constants.JDBC_USERNAME_PROPERTY, "<username>") > .put(Constants.JDBC_PASSWORD_PROPERTY, "<password>"); > } > }; > > cayenneRuntime = new ServerRuntime("cayenne-ARETariffDomain.xml", m1); > DataDomain dd = cayenneRuntime.getDataDomain(); > Collection<DataMap> dmaps = dd.getDataMaps(); > for (DataMap dm: dmaps) { > for (DbEntity entity: dm.getDbEntities()) { > entity.setSchema("p"); > } > } > ObjectContext ORMContext = cayenneRuntime.getContext(); > > > > *Rick Bonnett* > > *Programmer Analyst* > > Ascent Global Logistics > > PO Box 1039, Augusta, ME, 04332 > > Office: 207.620.8670 > > *ascentgl.com* <http://ascentgl.com/<http://ascentgl.com>> > > > > > The information transmitted is intended only for the person or entity to > which it is addressed and may contain proprietary, business-confidential > and/or privileged material. If you are not the intended recipient of this > message you are hereby notified that any use, review, retransmission, > dissemination, distribution, reproduction or any action taken in reliance > upon this message is prohibited. If you received this in error, please > contact the sender and delete the material from any computer. > The information transmitted is intended only for the person or entity to which it is addressed and may contain proprietary, business-confidential and/or privileged material. If you are not the intended recipient of this message you are hereby notified that any use, review, retransmission, dissemination, distribution, reproduction or any action taken in reliance upon this message is prohibited. If you received this in error, please contact the sender and delete the material from any computer.