Configuring Hibernate for PostgreSQL Access Over Unix Socket With JDBC
Dan <[email protected]> Sun, 8 Dec 2019 12:13:55 +0000
| Newsgroups | gmane.comp.db.postgresql.jdbc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--------------7F5D1A27B9B08A6D97F26225
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
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
--------------7F5D1A27B9B08A6D97F26225
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">Hello,</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">I hope it is
appropriate to send this question to this address. If not,
kindly redirect me.</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">I am trying
to configure Hibernate to use a Unix socket connection to my
local PostgreSQL installation. I have referred to this doc:</span><br>
<span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"><a
href="https://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters">https://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters</a><br>
</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">and have been
trying entries in hibernate.cfg.xml along these lines:</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"><property
name="hibernate.connection.url">jdbc:postgresql:kokodoko?socketFactory=org.newsclub.net.unix.socketfactory.PostgresqlAFUNIXSocketFactory&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432</property></span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">The XML
validator in Eclipse is flagging this error:</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"> The
reference to entity "socketFactoryArg" must end with the ';'
delimiter.</span></p>
<p><br>
<span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"><span
style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255); text-decoration-style: initial;
text-decoration-color: initial; display: inline !important;
float: none;">(Of course I have tried many variations such as
inserting semicolons in various places, quoting the argument,
using square brackets and so on.)</span></span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">If I ignore
the error and try to use config file I get this error:</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">{<br>
"error": {<br>
"errors": [<br>
{<br>
"domain": "global",<br>
"reason": "backendError",<br>
"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"<br>
}<br>
],<br>
"code": 503,<br>
"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"<br>
}<br>
}</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">which I take
to mean that the config file is unusable.</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">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?</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">I am posting
a similar request on the Hibernate forum.<br>
</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">Thanks very
much.</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;">-Dan<br>
</span></p>
<p><span style="color: rgb(13, 10, 11); font-family: "Open
Sans", sans-serif; font-size: 15.3333px; font-style:
normal; font-variant-ligatures: normal; font-variant-caps:
normal; font-weight: 400; letter-spacing: normal; orphans: 2;
text-align: left; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255); text-decoration-style: initial; text-decoration-color:
initial; display: inline !important; float: none;"><br>
</span></p>
</body>
</html>
--------------7F5D1A27B9B08A6D97F26225--