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 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 - 1.30
--- src/interfaces/jdbc/org/postgresql/Driver.java.in 29 Jun 2003 11:15:53 -
***
*** 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 - 1.44
--- doc/src/sgml/jdbc.sgml 29 Jun 2003 11:15:54 -
***
*** 33,39
This section describes the steps you need to take before you can
!write or run programs that use the JDBC interface.
--- 33,39
This section describes the steps you need to take before you can
!write or run programs that use the JDBC interface.
***
*** 49,63
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 PostgreSQL installation
! instructions. After installation, the driver should be found in
PREFIX/share/java/postgresql.jar.
The resulting driver will be built for the version of Java you are
running. If you build with a 1.1 JDK you will build a
! version that supports the JDBC 1 specification, if you build with
! a Java 2 JDK (e.g., JDK 1.2 or
! JDK 1.3) you will build a version that supports the
! JDBC 2 specification.
--- 49,65
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 PostgreSQL
! installation instructions.
! After installation, the driver should be found in
PREFIX/share/java/postgresql.jar.
The resulting driver will be built for the version of Java you are
running. If you build with a 1.1 JDK you will build a
! version that supports the JDBC 1 specification, if you build
! with a 1.2 or 1.3 JDK you will build a version that supports
! the JDBC 2 specification, and finally if you build with a
! 1.4 JDK you will build a version that supports the
! JDBC 3 specification.
***
*** 67,78
To use the driver, t