Re: [PATCHES] IPv6 patch doesn't work fine

From: Barry Lind <blind(at)xythos(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Kurt Roeckx <Q(at)ping(dot)be>, Manuel Gil Pérez <manuel(at)dif(dot)um(dot)es>, pgsql-patches(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [PATCHES] IPv6 patch doesn't work fine
Date: 2003-06-30 16:41:17
Message-ID: 3F00682D.1010203@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Patch applied.

thanks,
--Barry

Kris Jurka wrote:
>
> On Sat, 28 Jun 2003, Kurt Roeckx wrote:
>
>
>>On Thu, Jun 26, 2003 at 08:02:01AM -0400, Kris Jurka wrote:
>>
>>>
>>>On Thu, 26 Jun 2003, Manuel Gil [iso-8859-1] P?rez wrote:
>>>
>>>
>>>>Hi all.
>>>>
>>>>I have a Java application that it connects to the PostgreSQL database with
>>>>IPv6 patch installed.
>>>>
>>>
>>>What exactly do you have for the URL in the first argument to
>>>getConnection? If you have a direct IPv6 address like
>>>jdbc:postgresql://::1 it will not work at the moment because it tries to
>>>parse the url using the colon as a delimiter which works fine for IPv4
>>>addresses, but not IPv6 see org.postgresql.Driver#parseURL for more info.
>>>
>>>What happens if you are using a name that resolves to an IPv6 address?
>>>You're probably the first person to actually try this. I will look into
>>>this further, but it may take me a while to get IPv6 up and running on my
>>>machine.
>>
>>Did you get it working yet?
>>
>>
>>Kurt
>>
>
>
> The following patch allows you to connect using an IPv6 address by
> enclosing it in square brackets.
>
> jdbc:postgresql://[::1]:5432/dbname
>
> Additionally some minor cleanup to JDBC docs, adding <acronym> tags,
> mentioning JDBC 3 support, and cross referencing the installation
> instructions.
>
> Kris Jurka
>
>
>
> ------------------------------------------------------------------------
>
> Index: src/interfaces/jdbc/org/postgresql/Driver.java.in
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/Driver.java.in,v
> retrieving revision 1.30
> diff -c -r1.30 Driver.java.in
> *** src/interfaces/jdbc/org/postgresql/Driver.java.in 29 May 2003 04:39:51 -0000 1.30
> --- src/interfaces/jdbc/org/postgresql/Driver.java.in 29 Jun 2003 11:15:53 -0000
> ***************
> *** 272,277 ****
> --- 272,288 ----
> l_urlArgs = url.substring(l_qPos+1);
> }
>
> + // look for an IPv6 address that is enclosed by []
> + // the upcoming parsing that uses colons as identifiers can't handle
> + // the colons in an IPv6 address.
> + int ipv6start = l_urlServer.indexOf("[");
> + int ipv6end = l_urlServer.indexOf("]");
> + String ipv6address = null;
> + if (ipv6start != -1 && ipv6end > ipv6start) {
> + ipv6address = l_urlServer.substring(ipv6start+1,ipv6end);
> + l_urlServer = l_urlServer.substring(0,ipv6start)+"ipv6host"+l_urlServer.substring(ipv6end+1);
> + }
> +
> //parse the server part of the url
> StringTokenizer st = new StringTokenizer(l_urlServer, ":/", true);
> for (int count = 0; (st.hasMoreTokens()); count++)
> ***************
> *** 345,350 ****
> --- 356,365 ----
> }
> }
> }
> +
> + // if we extracted an IPv6 address out earlier put it back
> + if (ipv6address != null)
> + urlProps.put("PGHOST",ipv6address);
>
> //parse the args part of the url
> StringTokenizer qst = new StringTokenizer(l_urlArgs, "&");
> Index: doc/src/sgml/jdbc.sgml
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/jdbc.sgml,v
> retrieving revision 1.44
> diff -c -r1.44 jdbc.sgml
> *** doc/src/sgml/jdbc.sgml 7 Apr 2003 01:29:25 -0000 1.44
> --- doc/src/sgml/jdbc.sgml 29 Jun 2003 11:15:54 -0000
> ***************
> *** 33,39 ****
>
> <para>
> This section describes the steps you need to take before you can
> ! write or run programs that use the JDBC interface.
> </para>
>
> <sect2 id="jdbc-build">
> --- 33,39 ----
>
> <para>
> This section describes the steps you need to take before you can
> ! write or run programs that use the <acronym>JDBC</> interface.
> </para>
>
> <sect2 id="jdbc-build">
> ***************
> *** 49,63 ****
> <para>
> Alternatively you can build the driver from source, but you should
> only need to do this if you are making changes to the source code.
> ! For details, refer to the <productname>PostgreSQL</> installation
> ! instructions. After installation, the driver should be found in
> <filename><replaceable>PREFIX</>/share/java/postgresql.jar</filename>.
> The resulting driver will be built for the version of Java you are
> running. If you build with a 1.1 <acronym>JDK</> you will build a
> ! version that supports the JDBC 1 specification, if you build with
> ! a Java 2 <acronym>JDK</> (e.g., <acronym>JDK</> 1.2 or
> ! <acronym>JDK</> 1.3) you will build a version that supports the
> ! JDBC 2 specification.
> </para>
> </sect2>
>
> --- 49,65 ----
> <para>
> Alternatively you can build the driver from source, but you should
> only need to do this if you are making changes to the source code.
> ! For details, refer to the <productname>PostgreSQL</>
> ! <link linkend="installation">installation instructions</link>.
> ! After installation, the driver should be found in
> <filename><replaceable>PREFIX</>/share/java/postgresql.jar</filename>.
> The resulting driver will be built for the version of Java you are
> running. If you build with a 1.1 <acronym>JDK</> you will build a
> ! version that supports the <acronym>JDBC</> 1 specification, if you build
> ! with a 1.2 or 1.3 <acronym>JDK</> you will build a version that supports
> ! the <acronym>JDBC</> 2 specification, and finally if you build with a
> ! 1.4 <acronym>JDK</acronym> you will build a version that supports the
> ! <acronym>JDBC</> 3 specification.
> </para>
> </sect2>
>
> ***************
> *** 67,78 ****
> <para>
> To use the driver, the JAR archive (named
> <filename>postgresql.jar</filename> if you built from source, otherwise
> ! it will likely be named <filename>jdbc&majorversion;-1.1.jar</filename> or
> ! <filename>jdbc&majorversion;-1.2.jar</filename> for the JDBC 1 and JDBC 2 versions
> ! respectively)
> ! needs to be included in the
> ! class path, either by putting it in the <envar>CLASSPATH</envar>
> ! environment variable, or by using flags on the
> <command>java</command> command line.
> </para>
>
> --- 69,80 ----
> <para>
> To use the driver, the JAR archive (named
> <filename>postgresql.jar</filename> if you built from source, otherwise
> ! it will likely be named <filename>pg&majorversion;jdbc1.jar</filename>,
> ! <filename>pg&majorversion;jdbc2.jar</filename>, or
> ! <filename>pg&majorversion;jdbc3.jar</filename> for the <acronym>JDBC</> 1,
> ! <acronym>JDBC</> 2, and <acronym>JDBC</> 3 versions respectively)
> ! needs to be included in the class path, either by putting it in the
> ! <envar>CLASSPATH</envar> environment variable, or by using flags on the
> <command>java</command> command line.
> </para>
>
> ***************
> *** 81,87 ****
> <acronym>JDBC</acronym> driver to access a database, and that
> application is installed as
> <filename>/usr/local/lib/myapp.jar</filename>. The PostgreSQL
> ! JDBC driver installed as
> <filename>/usr/local/pgsql/share/java/postgresql.jar</>. To run
> the application, we would use:
> <programlisting>
> --- 83,89 ----
> <acronym>JDBC</acronym> driver to access a database, and that
> application is installed as
> <filename>/usr/local/lib/myapp.jar</filename>. The PostgreSQL
> ! <acronym>JDBC</> driver installed as
> <filename>/usr/local/pgsql/share/java/postgresql.jar</>. To run
> the application, we would use:
> <programlisting>
> ***************
> *** 113,120 ****
> Also, the client authentication setup in the
> <filename>pg_hba.conf</filename> file may need to be configured.
> Refer to <xref linkend="client-authentication"> for details. The
> ! <acronym>JDBC</acronym> driver supports the trust, ident,
> ! password, md5, and crypt authentication methods.
> </para>
> </sect2>
> </sect1>
> --- 115,123 ----
> Also, the client authentication setup in the
> <filename>pg_hba.conf</filename> file may need to be configured.
> Refer to <xref linkend="client-authentication"> for details. The
> ! <acronym>JDBC</acronym> driver supports the <literal>trust</>,
> ! <literal>ident</>, <literal>password</>, <literal>md5</>, and
> ! <literal>crypt</> authentication methods.
> </para>
> </sect2>
> </sect1>
> ***************
> *** 123,130 ****
> <title>Initializing the Driver</title>
>
> <para>
> ! This section describes how to load and initialize the JDBC driver
> ! in your programs.
> </para>
>
> <sect2 id="jdbc-import">
> --- 126,133 ----
> <title>Initializing the Driver</title>
>
> <para>
> ! This section describes how to load and initialize the <acronym>JDBC</>
> ! driver in your programs.
> </para>
>
> <sect2 id="jdbc-import">
> ***************
> *** 252,258 ****
> </term>
> <listitem>
> <para>
> ! The host name of the server. Defaults to <literal>localhost</literal>.
> </para>
> </listitem>
> </varlistentry>
> --- 255,264 ----
> </term>
> <listitem>
> <para>
> ! The host name of the server. Defaults to <literal>localhost</literal>. To specify an IPv6 address your must enclose the <replaceable class="parameter">host</replaceable> parameter with square brackets, for example:
> ! <programlisting>
> ! jdbc:postgresql://[::1]:5740/accounting
> ! </programlisting>
> </para>
> </listitem>
> </varlistentry>
> ***************
> *** 451,466 ****
> </para>
> </listitem>
>
> - <listitem>
> - <para>
> - <classname>ResultSet</classname> is currently read only.
> - You can not update data through the <classname>ResultSet</classname>.
> - If you want to update data you need to do it the normal way
> - by using the <acronym>SQL</acronym> statement <command>UPDATE</command>. This is
> - in conformance with the <acronym>JDBC</acronym> specification
> - which does not require drivers to provide updatable result sets.
> - </para>
> - </listitem>
> </itemizedlist>
> </para>
> </sect2>
> --- 457,462 ----
> ***************
> *** 606,616 ****
>
> <para>
> <xref linkend="jdbc-binary-data-example"> contains some examples on
> ! how to process binary data using the PostgreSQL JDBC driver.
> </para>
>
> <example id="jdbc-binary-data-example">
> ! <title>Processing Binary Data in JDBC</title>
>
> <para>
> For example, suppose you have a table containing the file names of
> --- 602,612 ----
>
> <para>
> <xref linkend="jdbc-binary-data-example"> contains some examples on
> ! how to process binary data using the PostgreSQL <acronym>JDBC</> driver.
> </para>
>
> <example id="jdbc-binary-data-example">
> ! <title>Processing Binary Data in <acronym>JDBC</></title>
>
> <para>
> For example, suppose you have a table containing the file names of
> ***************
> *** 2490,2501 ****
> <title>Connection Pools and Data Sources</title>
>
> <para>
> ! JDBC 2 introduced standard connection pooling features in an
> ! add-on API known as the <acronym>JDBC</acronym> 2.0 Optional
> Package (also known as the <acronym>JDBC</acronym> 2.0
> Standard Extension). These features have since been included in
> ! the core JDBC 3 API. The <productname>PostgreSQL</productname>
> ! <acronym>JDBC</acronym> drivers support these features if it has been compiled with
> <acronym>JDK</acronym> 1.3.x in combination with the
> <acronym>JDBC</acronym> 2.0 Optional Package
> (<acronym>JDBC</acronym> 2), or with <acronym>JDK</acronym> 1.4 or higher
> --- 2486,2498 ----
> <title>Connection Pools and Data Sources</title>
>
> <para>
> ! <acronym>JDBC</> 2 introduced standard connection pooling features in an
> ! add-on <acronym>API</> known as the <acronym>JDBC</acronym> 2.0 Optional
> Package (also known as the <acronym>JDBC</acronym> 2.0
> Standard Extension). These features have since been included in
> ! the core <acronym>JDBC</> 3 <acronym>API</>. The
> ! <productname>PostgreSQL</productname> <acronym>JDBC</acronym> drivers
> ! support these features if it has been compiled with
> <acronym>JDK</acronym> 1.3.x in combination with the
> <acronym>JDBC</acronym> 2.0 Optional Package
> (<acronym>JDBC</acronym> 2), or with <acronym>JDK</acronym> 1.4 or higher
> ***************
> *** 2510,2516 ****
> <title>Overview</title>
>
> <para>
> ! The <acronym>JDBC</acronym> API provides a client
> and a server interface for connection pooling. The client
> interface is <literal>javax.sql.DataSource</literal>,
> which is what application code will typically use to
> --- 2507,2513 ----
> <title>Overview</title>
>
> <para>
> ! The <acronym>JDBC</acronym> <acronym>API</> provides a client
> and a server interface for connection pooling. The client
> interface is <literal>javax.sql.DataSource</literal>,
> which is what application code will typically use to
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-06-30 16:41:38 Re: Bug in ResultSet.moveToCurrentRow
Previous Message Barry Lind 2003-06-30 16:40:13 Re: [PATCHES] Add checking in setMaxRows, setQueryTimeout, and setFetchSize

Browse pgsql-patches by date

  From Date Subject
Next Message Barry Lind 2003-06-30 16:44:16 Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Previous Message Barry Lind 2003-06-30 16:40:13 Re: [PATCHES] Add checking in setMaxRows, setQueryTimeout, and setFetchSize