IPv6 patch doesn't work fine
IPv6 patch doesn't work fine
От:
Manuel Gil Pérez <manuel@dif.um.es>
Дата:
Hi all.
I have a Java application that it connects to the PostgreSQL database with IPv6 patch installed.
I obtain the following error:
Something unusual has occured to cause the driver to fail.
Please report this exception: java.lang.NullPointerException
at org.postgresql.Driver.connect(Driver.java:125)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at piscis.pki.ca.database.DBManager.connect(DBManager.java:78)
In my class DBManager I have the following connection method:
class.ForName("org.postgresql.Driver");
Connection connect = DriverManager.getConnection(<dir. IPv6>,<user name>,<password>);
Which is my error?? Need I a special postgresql.jar??
Regards...
Manuel Gil Pérez - Proyecto m-PISCIS
DIIC - Dpto. Ingeniería de la Información y las Comunicaciones
Facultad de Informática - Universidad de Murcia (Spain)
ANTS Research Group - http://ants.dif.um.es
I have a Java application that it connects to the PostgreSQL database with IPv6 patch installed.
I obtain the following error:
Something unusual has occured to cause the driver to fail.
Please report this exception: java.lang.NullPointerException
at org.postgresql.Driver.connect(Driver.java:125)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at piscis.pki.ca.database.DBManager.connect(DBManager.java:78)
In my class DBManager I have the following connection method:
class.ForName("org.postgresql.Driver");
Connection connect = DriverManager.getConnection(<dir. IPv6>,<user name>,<password>);
Which is my error?? Need I a special postgresql.jar??
Regards...
Manuel Gil Pérez - Proyecto m-PISCIS
DIIC - Dpto. Ingeniería de la Información y las Comunicaciones
Facultad de Informática - Universidad de Murcia (Spain)
ANTS Research Group - http://ants.dif.um.es
Re: IPv6 patch doesn't work fine
От:
Kris Jurka <books@ejurka.com>
Дата:
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.
>
> Something unusual has occured to cause the driver to fail.
> Please report this exception: java.lang.NullPointerException
> at org.postgresql.Driver.connect(Driver.java:125)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:171)
> at piscis.pki.ca.database.DBManager.connect(DBManager.java:78)
>
> In my class DBManager I have the following connection method:
>
> class.ForName("org.postgresql.Driver");
> Connection connect = DriverManager.getConnection(, name>,);
>
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.
Kris Jurka
Re: IPv6 patch doesn't work fine
От:
Kurt Roeckx <Q@ping.be>
Дата:
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
Re: [JDBC] IPv6 patch doesn't work fine
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
Re: [JDBC] IPv6 patch doesn't work fine
От:
Barry Lind <blind@xythos.com>
Дата:
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 -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 ****
>
>
> 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, the JAR archive (named
> postgresql.jar if you built from source, otherwise
> ! it will likely be named jdbc&majorversion;-1.1.jar or
> ! jdbc&majorversion;-1.2.jar for the JDBC 1 and JDBC 2 versions
> ! respectively)
> ! needs to be included in the
> ! class path, either by putting it in the CLASSPATH
> ! environment variable, or by using flags on the
> java command line.
>
>
> --- 69,80 ----
>
> To use the driver, the JAR archive (named
> postgresql.jar if you built from source, otherwise
> ! it will likely be named pg&majorversion;jdbc1.jar,
> ! pg&majorversion;jdbc2.jar, or
> ! pg&majorversion;jdbc3.jar for the JDBC</> 1,
> ! JDBC</> 2, and JDBC</> 3 versions respectively)
> ! needs to be included in the class path, either by putting it in the
> ! CLASSPATH environment variable, or by using flags on the
> java command line.
>
>
> ***************
> *** 81,87 ****
> JDBC driver to access a database, and that
> application is installed as
> /usr/local/lib/myapp.jar. The PostgreSQL
> ! JDBC driver installed as
> /usr/local/pgsql/share/java/postgresql.jar</>. To run
> the application, we would use:
>
> --- 83,89 ----
> JDBC driver to access a database, and that
> application is installed as
> /usr/local/lib/myapp.jar. The PostgreSQL
> ! JDBC</> driver installed as
> /usr/local/pgsql/share/java/postgresql.jar</>. To run
> the application, we would use:
>
> ***************
> *** 113,120 ****
> Also, the client authentication setup in the
> pg_hba.conf file may need to be configured.
> Refer to for details. The
> ! JDBC driver supports the trust, ident,
> ! password, md5, and crypt authentication methods.
>
>
>
> --- 115,123 ----
> Also, the client authentication setup in the
> pg_hba.conf file may need to be configured.
> Refer to for details. The
> ! JDBC driver supports the trust</>,
> ! ident</>, password</>, md5</>, and
> ! crypt</> authentication methods.
>
>
>
> ***************
> *** 123,130 ****
> Initializing the Driver
>
>
> ! This section describes how to load and initialize the JDBC driver
> ! in your programs.
>
>
>
> --- 126,133 ----
> Initializing the Driver
>
>
> ! This section describes how to load and initialize the JDBC</>
> ! driver in your programs.
>
>
>
> ***************
> *** 252,258 ****
>
>
>
> ! The host name of the server. Defaults to localhost.
>
>
>
> --- 255,264 ----
>
>
>
> ! The host name of the server. Defaults to localhost. To specify an IPv6 address your must enclose the host parameter with square brackets, for example:
> !
> ! jdbc:postgresql://[::1]:5740/accounting
> !
>
>
>
> ***************
> *** 451,466 ****
>
>
>
> -
> -
> - ResultSet is currently read only.
> - You can not update data through the ResultSet.
> - If you want to update data you need to do it the normal way
> - by using the SQL statement UPDATE. This is
> - in conformance with the JDBC specification
> - which does not require drivers to provide updatable result sets.
> -
> -
>
>
>
> --- 457,462 ----
> ***************
> *** 606,616 ****
>
>
> contains some examples on
> ! how to process binary data using the PostgreSQL JDBC driver.
>
>
>
> ! Processing Binary Data in JDBC
>
>
> For example, suppose you have a table containing the file names of
> --- 602,612 ----
>
>
> contains some examples on
> ! how to process binary data using the PostgreSQL JDBC</> driver.
>
>
>
> ! Processing Binary Data in <acronym>JDBC</>
>
>
> For example, suppose you have a table containing the file names of
> ***************
> *** 2490,2501 ****
> Connection Pools and Data Sources
>
>
> ! JDBC 2 introduced standard connection pooling features in an
> ! add-on API known as the JDBC 2.0 Optional
> Package (also known as the JDBC 2.0
> Standard Extension). These features have since been included in
> ! the core JDBC 3 API. The PostgreSQL
> ! JDBC drivers support these features if it has been compiled with
> JDK 1.3.x in combination with the
> JDBC 2.0 Optional Package
> (JDBC 2), or with JDK 1.4 or higher
> --- 2486,2498 ----
> Connection Pools and Data Sources
>
>
> ! JDBC</> 2 introduced standard connection pooling features in an
> ! add-on API</> known as the JDBC 2.0 Optional
> Package (also known as the JDBC 2.0
> Standard Extension). These features have since been included in
> ! the core JDBC</> 3 API</>. The
> ! PostgreSQL JDBC drivers
> ! support these features if it has been compiled with
> JDK 1.3.x in combination with the
> JDBC 2.0 Optional Package
> (JDBC 2), or with JDK 1.4 or higher
> ***************
> *** 2510,2516 ****
> Overview
>
>
> ! The JDBC API provides a client
> and a server interface for connection pooling. The client
> interface is javax.sql.DataSource,
> which is what application code will typically use to
> --- 2507,2513 ----
> Overview
>
>
> ! The JDBC API</> provides a client
> and a server interface for connection pooling. The client
> interface is javax.sql.DataSource,
> which is what application code will typically use to
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend