Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 85C64B5DBE0 for ; Thu, 22 Sep 2011 20:16:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 23308-07 for ; Thu, 22 Sep 2011 23:16:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from smtp-out2.electric.net (smtp-out2.electric.net [72.35.23.39]) by mail.postgresql.org (Postfix) with ESMTP id 34C64B5DC35 for ; Thu, 22 Sep 2011 20:16:04 -0300 (ADT) Received: from 1R6sUr-0003Zc-VH by anders.electric.net with emc1-ok (Exim 4.76) (envelope-from ) id 1R6sUs-0003am-TR for pgsql-jdbc@postgresql.org; Thu, 22 Sep 2011 16:16:02 -0700 Received: by emcmailer; Thu, 22 Sep 2011 16:16:02 -0700 Received: from [10.86.5.46] (helo=fuse246.electric.net) by anders.electric.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R6sUr-0003Zc-VH for pgsql-jdbc@postgresql.org; Thu, 22 Sep 2011 16:16:01 -0700 Received: from mailanyone.net by fuse246.electric.net with esmtpa (MailAnyone extSMTP gocraig) id 1R6sUn-0000Sf-TV for pgsql-jdbc@postgresql.org; Thu, 22 Sep 2011 16:16:01 -0700 Reply-To: From: "Craig Golby" To: References: <4e7a9257.0443960a.7ee0.ffffc7c4SMTPIN_ADDED@mx.google.com> <4E7AB8CC.2000600@ringerc.id.au> In-Reply-To: <4E7AB8CC.2000600@ringerc.id.au> Subject: Re: JVM & JDBC Upgrade --- Help !! Date: Fri, 23 Sep 2011 00:16:00 +0100 Message-ID: <002e01cc797d$97f8ce40$c7ea6ac0$@golby@dignitas.ltd.uk> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_002F_01CC7985.F9BD3640" X-Mailer: Microsoft Office Outlook 12.0 thread-index: Acx438SyxUOoARNIQP+GJBNEHCylUwAmcLHw Content-Language: en-gb X-Outbound-IP: 10.86.5.46 X-Env-From: craig.golby@dignitas.ltd.uk X-PolicySMART: 1046319 X-Virus-Status: Scanned by VirusSMART (c) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, MSGID_MULTIPLE_AT=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201109/88 X-Sequence-Number: 22206 This is a multi-part message in MIME format. ------=_NextPart_000_002F_01CC7985.F9BD3640 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Craig, danap, thanks for the steer. I guess what is confusing me is that it works for pg73jdbc3 and fails when I switch it for postgresql-8.3-603.jdbc4 I have added a load of Sys Outs to try and figure out the location of the error, the code is pasted below. When I run this on the pg73jdbc3 Driver, so the existing solution, I get .. credability:Bean:reports:ataglance - starting getCurrent : columnCount = 5 credability:Bean:reports:ataglance - starting getCurrent : rowCount = 3 and of course there are multiple loops of the sysouts in the While loops. However when I run it using the postgresql-8.3-603.jdbc4, it spools out the following and then stops working. credability:Bean:reports:ataglance - starting getCurrent : columnCount = 5 credability:Bean:reports:ataglance - starting getCurrent : rowCount = 0 credability:Bean:reports:ataglance - starting getCurrent : b4 while credability:Bean:reports:ataglance - starting getCurrent : in while credability:Bean:reports:ataglance - starting getCurrent : in 2nd while credability:Bean:reports:ataglance - starting getCurrent : r = 0 credability:Bean:reports:ataglance - starting getCurrent : c = 0 So either the query is returning no data or the getFetchSize isnt working properly. Thoughts ?? CODE SNIPPET . if(conn != null) { try { pStmt = conn.prepareStatement(stmtStringSel); pStmt.clearParameters(); rsID = pStmt.executeQuery(); //Set up the Array ResultSetMetaData rsmd = rsID.getMetaData(); int columnCount = rsmd.getColumnCount(); int rowCount = rsID.getFetchSize(); rsCurrentreturn = new String[rowCount][columnCount]; System.out.println(sysOut + "starting getCurrent : columnCount = " + columnCount); System.out.println(sysOut + "starting getCurrent : rowCount = " + rowCount); int r=0; System.out.println(sysOut + "starting getCurrent : b4 while"); while(rsID.next()) { System.out.println(sysOut + "starting getCurrent : in while"); int c=0; int rsc=1; while (rsc <= columnCount) { System.out.println(sysOut + "starting getCurrent : in 2nd while"); System.out.println(sysOut + "starting getCurrent : r = " + r); System.out.println(sysOut + "starting getCurrent : c = " + c); rsCurrentreturn[r][c] = rsID.getString(rsc); c++; rsc++; } System.out.println(sysOut + "starting getCurrent : r++"); r++; } System.out.println(sysOut + "starting getCurrent : pStmt CLose"); pStmt.close(); }catch(SQLException se) {se.printStackTrace();} System.out.println(sysOut + "starting getCurrent : Done"); } stmtStringSel = ""; closeConnection(); System.out.println(sysOut + "starting getCurrent : Connection closed"); } From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Craig Ringer Sent: 22 September 2011 05:26 To: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] JVM & JDBC Upgrade --- Help !! On 09/22/2011 06:53 AM, Craig Golby wrote: Code Snippet . if(conn != null) { try { pStmt = conn.prepareStatement(stmtStringSel); pStmt.clearParameters(); rsID = pStmt.executeQuery(); //Set up the Array ResultSetMetaData rsmd = rsID.getMetaData(); int columnCount = rsmd.getColumnCount(); int rowCount = 7; rsOpened = new String[rowCount][columnCount]; int r=0; while(rsID.next()) { int c=0; int rsc=1; while (rsc <= columnCount) { rsOpened[r][c] = rsID.getString(rsc); Is the above line where the exception is thrown from? You didn't provide full exception context. If so, check and make sure the column count reported by `getColumnCount' matches what you expect and what the old driver provided. Compare it to the table. Compare the column-list metadata output from the old and new drivers to see which column(s) have appeared/disappeared. -- Craig Ringer ------=_NextPart_000_002F_01CC7985.F9BD3640 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Craig, danap, thanks for the steer.  I guess what = is confusing me is that it works for pg73jdbc3 and fails when I switch = it for postgresql-8.3-603.jdbc4

 

I have added = a load of Sys Outs to try and figure out the location of the error, the = code is pasted below.

 

When I run = this on the pg73jdbc3 Driver, so the existing solution, I get = ..

credability:Bean:reports:ataglance - = starting getCurrent : columnCount =3D 5

credability:Bean:reports:ataglance - = starting getCurrent : rowCount =3D 3

 

and of course there are multiple loops of = the sysouts in the While loops.

 

However when = I run it using the postgresql-8.3-603.jdbc4, it spools out the following = and then stops working…

credability:Bean:reports:ataglance - = starting getCurrent : columnCount =3D 5

credability:Bean:reports:ataglance - = starting getCurrent : rowCount =3D 0

credability:Bean:reports:ataglance - = starting getCurrent : b4 while

credability:Bean:reports:ataglance - = starting getCurrent : in while

credability:Bean:reports:ataglance - = starting getCurrent : in 2nd while

credability:Bean:reports:ataglance - = starting getCurrent : r =3D 0

credability:Bean:reports:ataglance - = starting getCurrent : c =3D 0

 

 

So either = the query is returning no data or the getFetchSize isnt working = properly.

 

Thoughts ??

 

 

CODE SNIPPET = …

    = if(conn !=3D null)

    { = try

      { pStmt =3D = conn.prepareStatement(stmtStringSel);

        = pStmt.clearParameters();

        rsID =3D = pStmt.executeQuery();

 

        //Set up the = Array

        ResultSetMetaData rsmd = =3D rsID.getMetaData();

        int columnCount =3D = rsmd.getColumnCount();

        int rowCount =3D = rsID.getFetchSize();

        rsCurrentreturn =3D new = String[rowCount][columnCount];

        = System.out.println(sysOut + "starting getCurrent : columnCount = =3D " + columnCount);

        = System.out.println(sysOut + "starting getCurrent : rowCount =3D = " + rowCount);

        int = r=3D0;

        = System.out.println(sysOut + "starting getCurrent : b4 = while");

        = while(rsID.next())

        { System.out.println(sysOut + "starting getCurrent : = in while");

          int = c=3D0;

          int = rsc=3D1;

          while (rsc = <=3D columnCount)

          { = System.out.println(sysOut + "starting getCurrent : = in 2nd while");

         &nb= sp;  System.out.println(sysOut + "starting getCurrent : r =3D = " + r);

         &nb= sp;  System.out.println(sysOut + "starting getCurrent : c =3D = " + c);

            = rsCurrentreturn[r][c] =3D rsID.getString(rsc);

            = c++;

            = rsc++;

          = }

          = System.out.println(sysOut + "starting getCurrent : = r++");

          = r++;

        = }

        System.out.println(sysOut + "starting getCurrent : = pStmt CLose");

        = pStmt.close();   =             &= nbsp;  

      }catch(SQLException se)  = {se.printStackTrace();}

    = System.out.println(sysOut + "starting getCurrent : = Done");

    } =

    stmtStringSel =3D = "";

    = closeConnection(); 

    System.out.println(sysOut + "starting getCurrent : = Connection closed");

  }

 

 

From: pgsql-jdbc-owner@postgresql.org = [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Craig = Ringer
Sent: 22 September 2011 05:26
To: = pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JVM & JDBC = Upgrade --- Help !!

 

On = 09/22/2011 06:53 AM, Craig Golby wrote:

 

Code = Snippet …

 

    if(conn !=3D = null)

    { try

      { pStmt =3D = conn.prepareStatement(stmtStringSel);

        = pStmt.clearParameters();

        rsID = =3D pStmt.executeQuery();

 

        = //Set up the Array

        = ResultSetMetaData rsmd =3D rsID.getMetaData();

        = int columnCount =3D rsmd.getColumnCount();

        = int rowCount =3D 7;

        = rsOpened =3D new String[rowCount][columnCount];

        = int r=3D0;

        = while(rsID.next())

        { int = c=3D0;

        &n= bsp; int rsc=3D1;

        &n= bsp; while (rsc <=3D columnCount)

          { = rsOpened[r][c] =3D rsID.getString(rsc);


Is the above line where the exception is thrown = from? You didn't provide full exception context.

If so, check and = make sure the column count reported by `getColumnCount' matches what you = expect and what the old driver provided. Compare it to the table. = Compare the column-list metadata output from the old and new drivers to = see which column(s) have appeared/disappeared.
 
--
Craig = Ringer

------=_NextPart_000_002F_01CC7985.F9BD3640--