Re: Specification of "/" in the host name (for Unix socket support)

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Deepak Bhole <dbhole(at)redhat(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Specification of "/" in the host name (for Unix socket support)
Date: 2003-09-13 00:05:03
Message-ID: 20030913000501.GC11696@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, Sep 12, 2003 at 03:20:49PM -0400, Deepak Bhole wrote:
>
> Hi,
>
> We are trying to add support for Unix sockets to the current jdbc (for
> our own release for now). The support is added via gnu classpath,located
> at: http://www.nfrese.net/software/gnu_net_local/overview.html
>
> Since Unix sockets require specification of path to the socket, the url
> would be something like: jdbc:postgresql:///tmp:5432/template1...
>
> However, since the path starts with a "/" which is a token separator,
> parseURL in Driver.java cannot handle it, and sets the host to "/". To
> find possible solutions, we referred to the URL RFC located at:
> http://www.w3.org/Addressing/rfc1738.txt
>
> Section 5, the BNF mentions that "% <hex> <hex>" is an escaped
> character. We are thinking of implementing a similar idea for the jdbc
> url. i.e. the URL jdbc:postgresql:///tmp:5432/template1... would have to
> be specified as jdbc:postgresql://%2Ftmp:5432/template1... , 2F being
> the ascii code for "/" in hex. This would of course necessitate the
> addition of an extra function for parsing tokens but it would be fairly
> simple to implement.
>
> Does the above mentioned approach seem reasonable or is there another
> format that should be followed?

Have you considered using something like "jdbc:postgresql-unix:...." and
having the parser handle the two cases separately? It's a different
communication path, after all .. "host" and "port" doesn't make much sense
for unix sockets. i.e. use something like:

jdbc:postgresql-unix:///var/run/postgresql/.s.PGSQL.5432/template1

In fact, since this isn't a network protocol at all, how about dropping the
"common internet scheme syntax" altogether in favour of clarity:

jdbc:postgresql-unix:/var/run/postgresql/.s.PGSQL.5432:template1

-O

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-09-13 01:26:36 Re: Bug #814
Previous Message Tom Lane 2003-09-12 23:53:49 Re: Specification of "/" in the host name (for Unix socket support)