Bug 239890 - java/openjdk11: openjdk 11.0.4+11.2 JDBC connections fail with IPv6 addresses
Summary: java/openjdk11: openjdk 11.0.4+11.2 JDBC connections fail with IPv6 addresses
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-15 21:27 UTC by Jonathan Chen
Modified: 2019-08-15 21:27 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (java)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Chen 2019-08-15 21:27:19 UTC
1.stormblade:jdbc-test,9:19am> cat J.java 
import java.sql.*;

public class J
{
        public static void
        main (
                String args[])
                throws Exception
        {
                String url = "jdbc:postgresql://[::1]/postgres?user=postgres";
                Connection conn = DriverManager.getConnection(url);
        }
}
1.stormblade:jdbc-test,9:20am> fetch https://jdbc.postgresql.org/download/postgresql-42.2.6.jar
postgresql-42.2.6.jar                                  823 kB  337 kBps    03s
1.stormblade:jdbc-test,9:20am> setenv JAVA_HOME /usr/local/openjdk8
1.stormblade:jdbc-test,9:20am> javac J.java 
1.stormblade:jdbc-test,9:21am> java -cp .:postgresql-42.2.6.jar J
1.stormblade:jdbc-test,9:21am> setenv JAVA_HOME /usr/local/openjdk11
1.stormblade:jdbc-test,9:21am> java -cp .:postgresql-42.2.6.jar J
Exception in thread "main" org.postgresql.util.PSQLException: The connection attempt failed.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
        at org.postgresql.Driver.makeConnection(Driver.java:458)
        at org.postgresql.Driver.connect(Driver.java:260)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
        at J.main(J.java:11)
Caused by: java.net.SocketException: Protocol family unavailable
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
        at java.base/java.net.Socket.connect(Socket.java:591)
        at org.postgresql.core.PGStream.<init>(PGStream.java:75)
        at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:91)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
        ... 7 more
1.stormblade:jdbc-test,9:24am> java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-2)
OpenJDK 64-Bit Server VM (build 11.0.4+11-2, mixed mode)