Re: Specification of "/" in the host name (for Unix socket support) - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Specification of "/" in the host name (for Unix socket support)
Date
Msg-id 20030913000501.GC11696@opencloud.com
Whole thread Raw
In response to Specification of "/" in the host name (for Unix socket support)  (Deepak Bhole <dbhole@redhat.com>)
Responses Re: Specification of "/" in the host name (for Unix socket  (Barry Lind <blind@xythos.com>)
List 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

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: Specification of "/" in the host name (for Unix socket support)
Next
From: Barry Lind
Date:
Subject: Re: Bug #814