Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yf8AT-0001ih-O7 for pgsql-jdbc@arkaria.postgresql.org; Mon, 06 Apr 2015 14:38:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yf8AT-0000dc-7m for pgsql-jdbc@arkaria.postgresql.org; Mon, 06 Apr 2015 14:38:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yf8AS-0000dS-0l for pgsql-jdbc@postgresql.org; Mon, 06 Apr 2015 14:38:24 +0000 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Yf8AN-0003wh-Kp for pgsql-jdbc@postgresql.org; Mon, 06 Apr 2015 14:38:22 +0000 Received: by lbbuc2 with SMTP id uc2so17674495lbb.2 for ; Mon, 06 Apr 2015 07:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=q7AQmcBFEyPNDXUNW0dpyiyX+ctj7yZfUiCSP/6FRmk=; b=Llbw8Qwqx1qcy0xMD57MtsVkZgs4h34Z0FbcnKflsjlvFZy2sl6/0zPmV0n/sm45Tf PpcxQ6KR0mOW9aVd9M3ZorDr5SRtY/59mKqyH7hkL2TYIjpPSOmlYizor4oQB+hqSx5j WvHQJc9Ulaamwo8z/kR5VF92izL2Q5SFGO8UbTUdt2tnhYCT9/jlTzETap3oVhKZ+8wt kwdWL36La5wavdnqtMzPqYuaIrZx556tYmhjIiAGdWchv8L52k5LrZilf1Q1SiIHdeff lcQ49wUYTNHsSRB+0eHw+mC0qnc4MM//IDFlF9aYKwmabiJuHooJm1tOcvgm+XbWwxkZ gpVg== X-Received: by 10.152.36.227 with SMTP id t3mr2448906laj.12.1428331097606; Mon, 06 Apr 2015 07:38:17 -0700 (PDT) Received: from [192.168.100.65] ([93.174.131.138]) by mx.google.com with ESMTPSA id i9sm1033704lbs.26.2015.04.06.07.38.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 07:38:16 -0700 (PDT) Message-ID: <55229A58.3080201@gmail.com> Date: Mon, 06 Apr 2015 17:38:16 +0300 From: Alex Ignatov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Binary transfer not working Content-Type: multipart/alternative; boundary="------------040103000001070701020403" X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org This is a multi-part message in MIME format. --------------040103000001070701020403 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello! Im testing jdbc binary transfer mode but i can't make it works as it should. Network packet dump always shows me that for example "dtrntran" TIMESTAMP column is transfering in text and not in binary representation as it should. Debug log shows me that binary mode is on, but regardless org.postgresql.forceBinary=false/true it is always text. What am i doing wrong? jdbc version - postgresql-9.4-1201.jdbc4.jar postgresql version - 9.4.1 This is my test code. javac vm arguments is -Dorg.postgresql.forceBinary=true import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Properties; import java.sql.Statement; import java.sql.Timestamp; public class TestMe { private static java.sql.Timestamp getCurrentTimeStamp() { java.util.Date today = new java.util.Date(); return new java.sql.Timestamp(today.getTime()); } public static void main(String[] args) throws SQLException { String url = "jdbc:postgresql://thunder:5432/test"; Connection conn = null; org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG); Properties connectionProps = new Properties(); connectionProps.put("user", "***"); connectionProps.put("password", "***"); connectionProps.put("loglevel", "2"); conn = DriverManager.getConnection(url, connectionProps); select(conn); } private static void select(Connection conn) { try { PreparedStatement fs = conn.prepareStatement("SELECT dtrntran FROM trn order by itrnnum limit 1"); ResultSet rs = fs.executeQuery(); for (int i = 0; i < 1; i++) { rs.next(); } rs.close(); System.out.println("org.postgresql.forceBinary= " + Boolean.getBoolean("org.postgresql.forceBinary")); } catch (SQLException e) { } } } --------------040103000001070701020403 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hello!
Im testing jdbc binary transfer mode but i can't make it works as it should.
Network packet dump always shows me that for example "dtrntran" TIMESTAMP column is transfering in text and not in binary representation as it should.
Debug log shows me that binary mode is on, but regardless org.postgresql.forceBinary=false/true it is always text.
What am i doing wrong?
jdbc version -  postgresql-9.4-1201.jdbc4.jar
postgresql version - 9.4.1
This is my test code. javac vm arguments is  -Dorg.postgresql.forceBinary=true

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import java.sql.Statement;
import java.sql.Timestamp;

public class TestMe {
    private static java.sql.Timestamp getCurrentTimeStamp() {

        java.util.Date today = new java.util.Date();
        return new java.sql.Timestamp(today.getTime());

    }

    public static void main(String[] args) throws SQLException {

        String url = "jdbc:postgresql://thunder:5432/test";
        Connection conn = null;
        org.postgresql.Driver.setLogLevel(org.postgresql.Driver.DEBUG);

        Properties connectionProps = new Properties();
        connectionProps.put("user", "***");
        connectionProps.put("password", "***");
        connectionProps.put("loglevel", "2");
        conn = DriverManager.getConnection(url, connectionProps);
        select(conn);
    }

    private static void select(Connection conn) {
        try {
            PreparedStatement fs = conn.prepareStatement("SELECT dtrntran FROM trn order by itrnnum limit 1");
            ResultSet rs = fs.executeQuery();
            for (int i = 0; i < 1; i++) {
                rs.next();
            }
            rs.close();
            System.out.println("org.postgresql.forceBinary= "
                    + Boolean.getBoolean("org.postgresql.forceBinary"));
        } catch (SQLException e) {
        }

    }
}


--------------040103000001070701020403--