pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
5+ messages / 3 participants
[nested] [flat]

* Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
@ 2019-12-08 12:13 Dan <dan@scapps.co.uk>
  2019-12-08 13:27 ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Sehrope Sarkuni <sehrope@jackdb.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Dan @ 2019-12-08 12:13 UTC (permalink / raw)
  To: pgsql-jdbc@lists.postgresql.org

Hello,

I hope it is appropriate to send this question to this address.  If not, 
kindly redirect me.

I am trying to configure Hibernate to use a Unix socket connection to my 
local PostgreSQL installation.  I have referred to this doc:
https://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters

and have been trying entries in hibernate.cfg.xml along these lines:

<property 
name="hibernate.connection.url">jdbc:postgresql:kokodoko?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432</property>

The XML validator in Eclipse is flagging this error:

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


(Of course I have tried many variations such as inserting semicolons in 
various places, quoting the argument, using square brackets and so on.)

If I ignore the error and try to use config file I get this error:

{
  "error": {
   "errors": [
    {
     "domain": "global",
     "reason": "backendError",
     "message": 
"org.hibernate.internal.util.config.ConfigurationException: Unable to 
perform unmarshalling at line number 0 and column 0 in RESOURCE 
hibernate.cfg.xml. Message: null"
    }
   ],
   "code": 503,
   "message": 
"org.hibernate.internal.util.config.ConfigurationException: Unable to 
perform unmarshalling at line number 0 and column 0 in RESOURCE 
hibernate.cfg.xml. Message: null"
  }
}

which I take to mean that the config file is unusable.

Is what I am trying to do (Hibernate, JDBC, PostgreSQL, 
hibernate.cfg.xml, Unix socket) possible?  If so, kindly give me some 
guidance.  If not, can you suggest a different approach that uses a Unix 
socket?

I am posting a similar request on the Hibernate forum.

Thanks very much.

-Dan

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
  2019-12-08 12:13 Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
@ 2019-12-08 13:27 ` Sehrope Sarkuni <sehrope@jackdb.com>
  2019-12-08 14:17   ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Radoslav Petrov <rado@edno.moe>
  2019-12-08 17:15   ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
  0 siblings, 2 replies; 5+ messages in thread

From: Sehrope Sarkuni @ 2019-12-08 13:27 UTC (permalink / raw)
  To: Dan <dan@scapps.co.uk>; +Cc: pgsql-jdbc@lists.postgresql.org

Is the issue the unescaped ampersand? (the "&")

Replace any raw & in the URL value with &amp; and see if that works. I
think this is just an XML parsing issue unrelated to the driver itself.

Regards,
-- Sehrope Sarkuni
Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
  2019-12-08 12:13 Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
  2019-12-08 13:27 ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Sehrope Sarkuni <sehrope@jackdb.com>
@ 2019-12-08 14:17   ` Radoslav Petrov <rado@edno.moe>
  2019-12-08 17:21     ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
  1 sibling, 1 reply; 5+ messages in thread

From: Radoslav Petrov @ 2019-12-08 14:17 UTC (permalink / raw)
  To: Sehrope Sarkuni <sehrope@jackdb.com>; Dan <dan@scapps.co.uk>; +Cc: pgsql-jdbc@lists.postgresql.org


On 8.12.2019 14:13, Dan wrote:
> <property 
> name="hibernate.connection.url">jdbc:postgresql:kokodoko?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432</property>

On 8.12.2019 15:27, Sehrope Sarkuni wrote:
> Is the issue the unescaped ampersand? (the "&")
>
> Replace any raw & in the URL value with &amp; and see if that works. I 
> think this is just an XML parsing issue unrelated to the driver itself.
>
> Regards,
> -- Sehrope Sarkuni
> Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

Also the documentation of `junixsockets` mentions three ways to provide 
the configuration of the JDBC connection for PostgreSQL. 
https://kohlschutter.github.io/junixsocket/dependency.html
It states mandatory use of `localhost` in the connection string for 
variant 1 and 2. IMO You are using variant 1.

-- 
Поздрави,       | Best regards,
Радослав Петров | Radoslav Petrov

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
  2019-12-08 12:13 Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
  2019-12-08 13:27 ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Sehrope Sarkuni <sehrope@jackdb.com>
  2019-12-08 14:17   ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Radoslav Petrov <rado@edno.moe>
@ 2019-12-08 17:21     ` Dan <dan@scapps.co.uk>
  0 siblings, 0 replies; 5+ messages in thread

From: Dan @ 2019-12-08 17:21 UTC (permalink / raw)
  To: Radoslav Petrov <rado@edno.moe>; Sehrope Sarkuni <sehrope@jackdb.com>; +Cc: pgsql-jdbc@lists.postgresql.org

Hi Radoslav,

Thanks very much for getting back to me.

Here is the config line that is now working for me:

             <property 
name="hibernate.connection.url">jdbc:postgresql:kokodoko?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&amp;socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432</property> 


-Dan

On 08/12/2019 14:17, Radoslav Petrov wrote:
>
>
> On 8.12.2019 14:13, Dan wrote:
>> <property 
>> name="hibernate.connection.url">jdbc:postgresql:kokodoko?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432</property>
>
> On 8.12.2019 15:27, Sehrope Sarkuni wrote:
>> Is the issue the unescaped ampersand? (the "&")
>>
>> Replace any raw & in the URL value with &amp; and see if that works. 
>> I think this is just an XML parsing issue unrelated to the driver itself.
>>
>> Regards,
>> -- Sehrope Sarkuni
>> Founder & CEO | JackDB, Inc. | https://www.jackdb.com/
>
> Also the documentation of `junixsockets` mentions three ways to 
> provide the configuration of the JDBC connection for PostgreSQL. 
> https://kohlschutter.github.io/junixsocket/dependency.html
> It states mandatory use of `localhost` in the connection string for 
> variant 1 and 2. IMO You are using variant 1.
>
> -- 
> Поздрави,       | Best regards,
> Радослав Петров | Radoslav Petrov

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
  2019-12-08 12:13 Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
  2019-12-08 13:27 ` Re: Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Sehrope Sarkuni <sehrope@jackdb.com>
@ 2019-12-08 17:15   ` Dan <dan@scapps.co.uk>
  1 sibling, 0 replies; 5+ messages in thread

From: Dan @ 2019-12-08 17:15 UTC (permalink / raw)
  To: Sehrope Sarkuni <sehrope@jackdb.com>; +Cc: pgsql-jdbc@lists.postgresql.org

Hi Sehrope,

Thank you for the reply and suggestion.  The unescaped ampersand was 
causing the problem.  I am now able to connect.

-Dan

On 08/12/2019 13:27, Sehrope Sarkuni wrote:
> Is the issue the unescaped ampersand? (the "&")
>
> Replace any raw & in the URL value with &amp; and see if that works. I 
> think this is just an XML parsing issue unrelated to the driver itself.
>
> Regards,
> -- Sehrope Sarkuni
> Founder & CEO | JackDB, Inc. | https://www.jackdb.com/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2019-12-08 17:21 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 12:13 Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC Dan <dan@scapps.co.uk>
2019-12-08 13:27 ` Sehrope Sarkuni <sehrope@jackdb.com>
2019-12-08 14:17   ` Radoslav Petrov <rado@edno.moe>
2019-12-08 17:21     ` Dan <dan@scapps.co.uk>
2019-12-08 17:15   ` Dan <dan@scapps.co.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox